Alternative to 'CurDir

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Access 97

Hi

I'm trying to locate the current directory in vba but the CurDir Function
isn't working. Is there an alternative to this function in Access VBA?
(Something like a Activedatabase.Path)

Thanks!
 
If you want the directory where the database is sitting, you can use the
Name method of the CurrentDB object:
Dim Filename as String
Filename = CurrentDB.Name

However, this will return both the path AND filename. To find just the
path, you have to do something like this:

Dim Path as String
Dim Filename as String
Filename = CurrentDB.Name
Path = Mid(Filename, 1, Len(Filename) - Len(Dir(Filename)))

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Back
Top