Database Path

J

jamesker

Hi,

I am trying to find the path that the my database is in using VB.
example

dim dbPath as string
dbPath = currentDatabase.path

I know this is incorrect code and I don't know how to write the
correct code. To do the same thing in Excel is as follows:

dbPath = ThisWorkbook.Path

Does anyone know how to do this?? thanks.
 
D

Douglas J. Steele

Aaron's incorrect: there's no Path property for the CurrentDb object.

CurrentDb.Name will give you the full path to the file. You can retrieve
only the path using:

Left(CurrentDb.Name, Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))

Alternatively, Access 2000 and newer have Application.CurrentProject.Path
 
Top