Finding the Path to the Database in VBA

G

Guest

My Access database is a combination a Microsoft Project file that holds
several projects and my own application that intigrates and builds on the
Project functionality. However, to open Project I need to use the following
command:

Application.OpenFile("<C:\ProjectOffice\ProjectOffice2002.mdb>"\123456)

However, there is no gauruntee that the user will use the path I have shown
above. I need the code the programatically check where that database is
being stored so it can put it in the line above.

Now, I know in the general options of Access there is a place where you can
type the default path. Is there any way I can access this information using
VBA?

Thanks!

Dustin Ventin
 
D

Douglas J. Steele

You can determine the path of the current database using

Application.CurrentProject.Path

Application.CurrentProject.FullName will give you the path and file name,
while Application.CurrentProject.Name will give you just the file name.

You can also determine the path and file name using CurrentDb().Name
 

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

Top