Current database Location

T

Tony Nichols

Can someone tell me if there is a property to find the location of the
database that is currently open? I want to determine the path location of
the file so I can set a variable to upload an Excel file.

I was hoping to use some code like the following:

Dim sPath as String
Dim db as database

Set db = currentDB()

sPath = db.FileLocation


Thanks,
Tony
 
T

Tony Nichols

Alex,

Thanks for the input. I tried the property and found that it was returning
the recent location the database was open from not where the database is
actually stored.

Is there another property that returns the actual location where the
database is stored?

Thanks,
Tony
 
D

Douglas J. Steele

What do you mean by "the recent location the database was open from" vs.
"where the database is actually stored"?

CurrentDB.Name is the location of the MDB file in which the code is running.
Perhaps you're not actually opening the database you think you are.
 
T

Tony Nichols

Doug,

I had an error in my code giving me the CurDir, I had not review the code
close enough before I posted again.

Thanks for the input, thus forcing me to look back at the code to find the
problem.

Tony
 
D

Douglas J. Steele

Glad you got it sorted out.

For the record, CurDir has nothing to do with where the database is stored.
 
A

Ahamed

On current database window
click on file, properties then on General tab you will see the current
location of your database

Ahamed Farook
 

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