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
> 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, "_"))