Well, if you are linked to a table in the second DB you could use the "Connect" property of that linked table. Something like:
mid(currentdb().TableDefs("linkedtablename").Conne ct,11)
That syntax doesn't work in a query. So you can write a function to return the value:
Code:
Function LinkedTableFile(pstrTableName as string) as Variant
on error goto ReturnNull
LinkedTableFile = mid(currentdb().TableDefs(pstrTableName).Connect,11)
Exit_Here:
Exit Function
ReturnNull:
LinkedTableFile = Null
resume Exit_Here
End Function
Beware, there is a lot of overhead created using "CurrentDB()". So using this function in a field in a query with lots of rows could affect your performance.
You can improve your performance for lots of rows by adding:
Code:
Static db as Database
if db is nothing then Set db = CurrentDB()
And change to:
Code:
LinkedTableFile = mid(db.TableDefs(pstrTableName).Connect,11)
Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org