Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / January 2006

Tip: Looking for answers? Try searching our database.

Modify file name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BobbyS - 07 Jan 2006 21:49 GMT
I am writing a procedure to import text files to tables in the database.
Tables in the db have neames like Routes, tblFirm, etc..

The export function I wrote appends the current table name to include the
UserName and an underscore to the front of the table name: i.e.
BobbyS_Routes, BobbyS_Firm, etc.

The user will have a list of txt files in a list box on the form. After
selecting the appropriate table it is assigned to a variable
(strTblName),modify the textfile name to not include the Username &
underscore.

Thank you
Dirk Goldgar - 07 Jan 2006 22:05 GMT
> I am writing a procedure to import text files to tables in the
> database. Tables in the db have neames like Routes, tblFirm, etc..
[quoted text clipped - 9 lines]
>
> Thank you

You don't explicitly ask a question, but I think you are asking how to
take a string, stored in strTblName, that is formatted like
"<username>_<tablename>", and drop the "<username>_" prefix.  The
following line will do that:

   strTblName = Mid(strTblName, 1 + InStr(strTblName, "_"))

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

BobbyS - 07 Jan 2006 22:49 GMT
You had what I need right but when I run it it returns "".

Thanks

> > I am writing a procedure to import text files to tables in the
> > database. Tables in the db have neames like Routes, tblFirm, etc..
[quoted text clipped - 16 lines]
>
>     strTblName = Mid(strTblName, 1 + InStr(strTblName, "_"))
BobbyS - 07 Jan 2006 23:01 GMT
Got it to work..thanks for the right direction tho..

strTblName = Mid(strTblName, InStr(strTblName, "_") + 1)

> You had what I need right but when I run it it returns "".
>
[quoted text clipped - 20 lines]
> >
> >     strTblName = Mid(strTblName, 1 + InStr(strTblName, "_"))
Dirk Goldgar - 08 Jan 2006 03:05 GMT
Odd, what I posted works for me, and I can't see any practical or
theoretical difference between

   InStr(strTblName, "_") + 1

and

   1 + InStr(strTblName, "_")

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

> Got it to work..thanks for the right direction tho..
>
[quoted text clipped - 24 lines]
>>>
>>>     strTblName = Mid(strTblName, 1 + InStr(strTblName, "_"))
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.