Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Current Database Path

Status
Not open for further replies.

PaulCoop

Programmer
Apr 3, 2001
31
GB
How can I get the full path of the access database that I am running? The aim of getting this path is to create dynamic linking with a table in another access database that exists in the same directory but the database is stored in different locations on different workstations.

CurDir() doesn't work. I have tried to use the Windows API using the function GetCommandlineA from kernal32.dll but that isn't even recognised as a valid function and according to various web pages that function is known to crash under various OSs.

Any suggestions anyone?

Paul Cooper
 
Use CurrentDB.Name

Ed Metcalfe.

Please do not feed the trolls.....
 
Talk about not see the wood for the trees. :)

Cheers

Paul
 
Talk about not seeing the wood for the trees. :)

Cheers

Paul
 
If you are looking for the path and the database name
then currentdb.name is yer only man.

If you are looking for a way to get the path only without
having to go mid$'ing, then the following is the muts nuts:

Application.CurrentProject.Path

Regards...
 
Assuming he's using MS Access 2000 or 2002.....

Ed Metcalfe

Please do not feed the trolls.....
 
Thanks Chickey, but I am using a mix of access 97 and 2000 so I will have to stick to mid$'ing

Paul
 
If you use ADO: CurrentProject.FullName
In DAO: CurrentDb.Name
If you have both references, any of the above.
By default, Access 97 works with DAO and Access 2K with ADO.
Both can be changed by adding the appropriate references.
For the path, check thread702-536966

Good luck



[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top