By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,761 Members | 1,879 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,761 IT Pros & Developers. It's quick & easy.

Parsing mdb filename from linked table connect property

P: n/a
From tbldef.connect, e.g. ;DATABASE = c:\mike\development\link.mdb

I want to extract link.mdb as a string.

This is the best I've come up with:

Set db = CurrentDb()
Set tbl = db.TableDefs(0)
strLinkPath = tbl.Connect
intPos = Len(strLinkPath)
Do While Mid$(strLinkPath, intPos, 1) <> "\"
intPos = intPos - 1
Loop
strFEFileName = Mid$(strLinkPath, intPos + 1)

Is there a better way. Like InStr starting from the right?

TIA, Mike MacSween
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
InstrRev() is useful from A2000 onwards.

Alternatively, you can use the fact that Dir() loses the path:
Dir(Mid(dbEngine(0)(0).TableDefs("MyTable).Connect , 11))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mike MacSween" <mi******************@btinternet.com> wrote in message
news:3f***********************@pubnews.gradwell.ne t...
From tbldef.connect, e.g. ;DATABASE = c:\mike\development\link.mdb

I want to extract link.mdb as a string.

This is the best I've come up with:

Set db = CurrentDb()
Set tbl = db.TableDefs(0)
strLinkPath = tbl.Connect
intPos = Len(strLinkPath)
Do While Mid$(strLinkPath, intPos, 1) <> "\"
intPos = intPos - 1
Loop
strFEFileName = Mid$(strLinkPath, intPos + 1)

Is there a better way. Like InStr starting from the right?

TIA, Mike MacSween

Nov 12 '05 #2

P: n/a
Thanks Allen

"Allen Browne" <al*********@SeeSig.invalid> wrote in message
news:jx********************@news-server.bigpond.net.au...
InstrRev() is useful from A2000 onwards.

Alternatively, you can use the fact that Dir() loses the path:
Dir(Mid(dbEngine(0)(0).TableDefs("MyTable).Connect , 11))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mike MacSween" <mi******************@btinternet.com> wrote in message
news:3f***********************@pubnews.gradwell.ne t...
From tbldef.connect, e.g. ;DATABASE = c:\mike\development\link.mdb

I want to extract link.mdb as a string.

This is the best I've come up with:

Set db = CurrentDb()
Set tbl = db.TableDefs(0)
strLinkPath = tbl.Connect
intPos = Len(strLinkPath)
Do While Mid$(strLinkPath, intPos, 1) <> "\"
intPos = intPos - 1
Loop
strFEFileName = Mid$(strLinkPath, intPos + 1)

Is there a better way. Like InStr starting from the right?

TIA, Mike MacSween


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.