Database File Path (1 Viewer)

GUIDO22

Registered User.
Local time
Today, 08:59
Joined
Nov 2, 2003
Messages
515
Is there a simple way of determining the exact file path for the current database using VBA? I have tried using CurDir() but this does not return the DB file - but MyDocuments on another drive.....???
 

PeterF

Registered User.
Local time
Today, 09:59
Joined
Jun 6, 2006
Messages
295
currentdb.name gives the full databasename,
use left(currentdb.name , InStrRev(currentdb.Name , "\") ) to get only the path.
 

GUIDO22

Registered User.
Local time
Today, 08:59
Joined
Nov 2, 2003
Messages
515
InStrRev - my guess this function is new and does not appear to be available in Access '97..... I guess I will have to write my own... unless you know of an alternative..????
 

jubb

Registered User.
Local time
Today, 17:59
Joined
Jul 27, 2005
Messages
50
Hi,

try
Code:
CurrentProject.Path

this will give you the full file path to your current db

Cheers
 

GUIDO22

Registered User.
Local time
Today, 08:59
Joined
Nov 2, 2003
Messages
515
jubb said:
Hi,

try
Code:
CurrentProject.Path

this will give you the full file path to your current db

Cheers

Sorry Jubb - but as stated I am using 97 and this covention is not permitted in this version......
 

jubb

Registered User.
Local time
Today, 17:59
Joined
Jul 27, 2005
Messages
50
Hi,

Not sure if you worked this out or not but the following should work in access97.

'returns the current database file name
Dir(CurrentDb.Name)

'Returns the current database path
Left(CurrentDb.Name,Len(CurrentDb.Name)-Len(Dir(CurrentDb.Name)))

'Returns the current database path and the file name
CurrentDb.Name

Thanks
Jubb
 

Users who are viewing this thread

Top Bottom