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

determine location of Access Database 1

Status
Not open for further replies.

PaulSc

MIS
Aug 21, 2000
148
GB
Hi, I wonder if anybody can help/point me in the right direction please.

I have a split access 97 database, with the Front-end being located on the user hard drive and the back-end on a server

I am using a QueryDef to create a new query and want this stored in the Front-End database.

Currently this is achievd by setting global variables which contain the physical location of the front/back end databases but we constantly need to change these and some users install the database in alternative locations.

Can anyone please point me to some way of extracting the location from where the front end is invoked please.

Cheers

PaulSc
 
This should do the trick...


Function DBDir() As String

Dim strName As String
Dim intCounter As Integer
Dim strDIR As String

strName = CurrentDb.Name

For intCounter = 1 To Len(strName)
strDIR = Mid(strName, intCounter, 1) & strDIR
Next intCounter

DBDir = Left(strName, Len(strName) - InStr(strDIR, "\") + 1)

End Function
 
Code:
Function basDBDir() As String

    'Michael Red.   2/5/2002.   To return the Path to the current DB

    basDBDir = Left(CurrentDb.Name, Len(CurrentDb.Name) - InStrRev(CurrentDb.Name, "\") - 2)

End Function
[code]

NOTE this only works for DAO references. and ONLY returns info on the FRONT end of a "split" db.

For the actual data references of linked tables, use MSysObjects, which is a hidden table in Ms. A.

 MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top