How to get the full path to database

  • Thread starter Thread starter jijohansson
  • Start date Start date
J

jijohansson

Guest
I'm using Access 97 and I would like to find the path to the currently open database with code like:

Dim currDb As Database
Dim path As String

Set currDb = CurrentDb
path = CurrentDb.Name

This used to give me the full path but my computer crashed and since the recovery I get the path with directories shortened to the Dos 8 character format:

E:\SOFTWA~1\DATABA~1\My Fancy Db.mdb

The database name is always the full length though. Is it possible for me to force the retrieval of the full path name (ie with full length directories) from VBA, or is this something that needs to be set in the operating system?

Thank you,
Jon.
 
Try setting a variable in your code to application.currentdb.name This should pull the entire path. I was also having trouble getting it to pull the full path, but this seems to work for me.

Roni
 
Thanks for your suggestion Roni, but I'm afraid the problem is deeper than that. I tried your recommendation and get exactly what was getting before. I'm running NT4 and a registry hive became corrupted. I restored the registry from an emergency recovery disk but it seems some system settings have been changed. I was hoping that there might be a way in VBA to force the full directories being provided, but as I look at in now I think I'm just going to have to either reinstall NT or look at the details of the registry and try to find the source of this problem: neither is very appealing right now.

Thanks again,
Jon.
 

Users who are viewing this thread

Back
Top Bottom