Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the Path to an Access Linked Table

Status
Not open for further replies.

Headwinds

Programmer
Feb 6, 2001
38
US
I need to find the path of a linked table in an Access 2000 database that I have open as an object in VFP6.

In VFP, I open the Access database as follows:
Code:
oAcc = CREATEOBJECT("Access.Application")
oAcc.Visible = .T.
oAcc.DOCMD.maximize		&& Maximize the project
#DEFINE acCmdAppMaximize 10
oAcc.DoCmd.RunCommand(acCmdAppMaximize)  && Maximize Access 
m.dostring = "oAcc.OpenCurrentDatabase('acc.mdb', -1)"
Within Access, I can query the Connect property of the linked table like this:
Code:
MsgBox (Mid(CurrentDb.TableDefs("LinkedTableName").Connect, _
InStr(CurrentDb.TableDefs("LinkedTableName").Connect, ";DATABASE=") + 10))
So I know the information is available, BUT I can't figure out how to get the path to the linked table by running an analogous command in VFP.

TIA for any suggestions.
 
Explore the reference on DBEngine; Specifically,

oAcc.DBEngine.Workspaces(0).databases(0).name
 
Yes, that does it. I can use:
Code:
m.thisLink = oAcc.DBEngine.Workspaces(0).databases(0).TableDefs("LinkedTableName").Connect
(and then take the appropriate substring for the path)

Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top