using back-end location in VBA code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using Access 2002.

Is it possible to use the location of the back-end database in VBA? I have
used the CurrentProject property to avoid using absolute paths when linking
to external files. The files are stored in the same directory as the
backend. I have discovered since splitting my DB and moving the front end
that the CurrentProject refers to the front end and so my relative links no
longer work.

Thanks

Alice
 
If you have a static link to the back end, you can extract its location from
the Connect property of any linked table.

HTH
- Turtle
 
I use:

Function strBackEndPath() As String

Dim mytables As TableDef

Dim strTempBack As String
Dim strFullPath As String
strFullPath = ""

For Each mytables In CurrentDb.TableDefs
If Left(mytables.Connect, 10) = ";DATABASE=" Then
strFullPath = Mid(mytables.Connect, 11)
Exit For
End If
Next mytables

strBackEndPath = Left(strFullPath, Len(strFullPath) -
Len(Dir(strFullPath)))


End Function
 
Back
Top