Database Path

  • Thread starter Thread starter jamesker
  • Start date Start date
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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top