get database path programmatically

  • Thread starter Thread starter martin
  • Start date Start date
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.
 
Thanks Tim. But, I was wondering if this cannot be
applied in an Access 97 database application?
 
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)))
 
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)))


.
 
Back
Top