get database path programmatically

M

martin

how would i be able to programmatically obtain the path
that a database is in? i have a database application that
several users will be using in our organization. the path
that users have mapped to our server may vary, ie. some
users might have the server mapped to Q:\gldata, others
might have Q:\Budget\gldata, and some could even have a
different letter drive - N:\gldata, etc. the variations
are not fixed at all so i have no way of knowing exactly
how all users are mapped to our server and/or are able to
access the application.

i initially thought that CurDir() would allow me to obtain
that information, but all it does is let me know what the
default directory a user has.
 
M

martin

Thanks Tim. But, I was wondering if this cannot be
applied in an Access 97 database application?
 
J

John Spencer (MVP)

CurrentDB().Name

Gives you the full path and filename of the database.

To get JUST the directory you need to strip off the filename

Dir(CurrentDB().Name) will return the filename. SO, put them all together and
you get the ONE line below.

Left(currentdb().name,Len(currentdb.name)-Len(Dir(currentdb().name)))
 
M

martin

Thanks a lot. That's exactly what I needed!!
-----Original Message-----
CurrentDB().Name

Gives you the full path and filename of the database.

To get JUST the directory you need to strip off the filename

Dir(CurrentDB().Name) will return the filename. SO, put them all together and
you get the ONE line below.

Left(currentdb().name,Len(currentdb.name)-Len(Dir (currentdb().name)))


.
 

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

Top