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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get only the linked database name?

Status
Not open for further replies.

ekwstats

MIS
Feb 2, 2004
70
US
I need to use the name of the database that I am linked to in some File path values.
My program creates different folders for different companies so if you create a new company called test it creates a folder called Test with a new company database called test.mdb in it and then links to that new company. It also creates a Test\Pictures folder. I want to be able to use the Test value to tell the program where to look for the pictures.
LinkedDatabase = test

Application.CurrentProject.Path LinkedDatabase & "\Pictures"


Hopefully this makes sense.
 
You can use one of the linked tables to find the path of the linked database. For example, for the code below, just parse out the linked file path from the tdf.connect string

Code:
Public Function GetBEPath()
  Dim tdf As DAO.TableDef
  Dim db As DAO.Database
  
  Set db = CurrentDb
  Set tdf = db.TableDefs("MyLinkedTableName")
  
  ' If connect is blank, it is not a linked table
  If Len(tdf.Connect) > 0 Then
    ' so, just parse the file path from tdf.connect
    Debug.Print tdf.Connect
  End If

End Function
Cheers,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top