Function for file path

vedran

New member
Local time
Today, 06:58
Joined
Dec 11, 2006
Messages
1
Hi,

I'm looking for function whitch returns path of current mdb Access file running.

For file started from d:\bla\bla\base.mdb returns

d:\bla\bla\

Thanks
 
Function CurrentDBDir() As String
Dim strDBPath As String
Dim strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
CurrentDBDir = Left(strDBPath, Len(strDBPath) - Len(strDBFile))
End Function
 
It is quite simple really if you have Access 2000 or above:

CurrentProject.Path
 
That Search button really does work.

Getting the location to the current database using Access 2000/2002/2003...

'returns the database file name
CurrentProject.Name

'returns the database path
CurrentProject.Path

'returns the database path and the file name
CurrentProject.FullName

Getting the location to the current database using Access 97...

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

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

'returns the database path and the file name
CurrentDb.Name

'returns the directory that Access [msaccess.exe] is installed in
(SysCmd(acSysCmdAccessDir))
 

Users who are viewing this thread

Back
Top Bottom