connectstrg = tabledefs("alinkedtable").connect
Is no where in my code?? I think you would have to use Currentdb.Tabledefs().connect
You cannot use tabledefs without a database pre-qualifier, which is more or less what you did with DBEngine.Workspaces(0).Databases(0).... except much more complex...
A quick test on one of my linked tables is returns the path no problem, barring the fact that it is prefixed with ";DATABASE=" which you will need to remove for the path to be usefull.
Also the path contains the BE database, which then has to be removed...
The only reason Currentdb.Tabledefs("Table").Connect would return a null, is if it IS NULL. I.e. When there is no connect for a local table...
Your lack of InstrRev can also be circumvented by using Dir... Dir(FullBePathAndFileName) will return only the filename... I.e.
strFilename = dir(connectstrg)
Path = mid(connectstrg, len(connectstrg) - len(strfilename) )
To come back to the blank, I am guessing your checking a local table for a connection. Which obviously dont exist.
You can check if the table is a linked table by using...
Currentdb.Tabledefs("Table").Attributes = dbAttachedTable
Also I would advice you (from my own experience) to keep the last \ in the full path returned by your function, but that may be personal preverence.
Is no where in my code?? I think you would have to use Currentdb.Tabledefs().connect
You cannot use tabledefs without a database pre-qualifier, which is more or less what you did with DBEngine.Workspaces(0).Databases(0).... except much more complex...
A quick test on one of my linked tables is returns the path no problem, barring the fact that it is prefixed with ";DATABASE=" which you will need to remove for the path to be usefull.
Also the path contains the BE database, which then has to be removed...
The only reason Currentdb.Tabledefs("Table").Connect would return a null, is if it IS NULL. I.e. When there is no connect for a local table...
Your lack of InstrRev can also be circumvented by using Dir... Dir(FullBePathAndFileName) will return only the filename... I.e.
strFilename = dir(connectstrg)
Path = mid(connectstrg, len(connectstrg) - len(strfilename) )
To come back to the blank, I am guessing your checking a local table for a connection. Which obviously dont exist.
You can check if the table is a linked table by using...
Currentdb.Tabledefs("Table").Attributes = dbAttachedTable
Also I would advice you (from my own experience) to keep the last \ in the full path returned by your function, but that may be personal preverence.