Finding path of current database? 
Author Message
 Finding path of current database?

Hi,

How is it possible in a VBA macro to get the path of the current Access
database? For example, if the Access mdb file path is "C:\My Documents\My
DB.mdb", how can I get the "C:\My Documents\" programmatically?

Thanks,
Seb



Sun, 11 Dec 2005 00:34:36 GMT  
 Finding path of current database?
Assuming A2000 or later.

Currentproject.path
will give you
C:\My Documents

You'll have to add the final \ yourself.

Regards

Peter Russell

Quote:

> Hi,

> How is it possible in a VBA macro to get the path of the current Access
> database? For example, if the Access mdb file path is "C:\My
> Documents\My
> DB.mdb", how can I get the "C:\My Documents\" programmatically?

> Thanks,
> Seb



Sun, 11 Dec 2005 01:06:00 GMT  
 Finding path of current database?
Seb,

Just a point of clarification... In Access there is no such thing as a
VBA macro.  A macro is a macro, and vba is vba.

There may be more elegant ways of doing it, but this works...
Left(CurrentDb.Name, Len(CurrentDb.Name)-Len(Dir(CurrentDb.Name)))

- Steve Schapel, Microsoft Access MVP

Quote:

>Hi,

>How is it possible in a VBA macro to get the path of the current Access
>database? For example, if the Access mdb file path is "C:\My Documents\My
>DB.mdb", how can I get the "C:\My Documents\" programmatically?

>Thanks,
>Seb



Sun, 11 Dec 2005 03:04:58 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ADSI:GetObject network path not found reading info other than the current computer name

2. Finding the current programs path and filename

3. current database path

4. How to get path of current database?

5. Path of Current database ?

6. Get current database directory path

7. Current database path name

8. Setting the path to the path of the current application

9. Find the path of the database file

10. How to find path to database before invoking OpenDatabase

11. Long Path Names give Runtime error 76 - Path not found

12. Get current path in Access97

 

 
Powered by phpBB® Forum Software