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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding the current path 3

Status
Not open for further replies.

KornGeek

Programmer
Aug 1, 2002
1,961
US
I think this has been answered before, but I can't find it anywhere. I am trying to programmatically determine the path where the database file is located. This will be used to help re-link tables in a relative path.

Is there a function to do this? I know there's one to find where Access is located, but I can't find the one for this.

Thanks.
 
Hi KornGeek,

Temp will equal the path for the current db in the code below.

Dim dbs As Database, temp As String
Set dbs = CurrentDb

temp = dbs.Name
dbs.Close

Let me know if this helps. Regards,
gkprogrammer
 
Thanks, that looks like it should work. However, I'm getting a strange error. The compiler is not recognizing the Database type. It gives me the message "Compile Error: User-defined type not defined." I thought this was one of the standard types in Access.

How are you defining it?

Thanks for your help.
 
Try to include DAO v.3.61 (Tools - Reference)
Not quite sure of the version number but you'll find something similar in your references.

Hope this helps...

Borg
 
If you are using ADO (default in A2k+)

then

simply CurrentProject.Path will give the path to the file and CurrentProject.Name will return the name of the file.

HTH

Ben ----------------------------------------
Ben O'Hara
----------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top