Alternative to 'CurDir

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!
 
R

Roger Carlson

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
 

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

Similar Threads


Top