Finding Current mdb or mde name & folder

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, Thanks in advance.

Need to know the current database name and file extension. Together with
folder name. I need the following stings completing as an example.

do action here to find:-

mydbfile = "test"
mydbext = "mdb"
mydbfolder = "c:\Database\Current\"

Thanks once again


trev
 
Assuming Access 2000 or later. I'm also assuming only one "." in the name -
if you can't make that assumption, you'll need to modify the example a bit
to look for the extension in the last element of the array.

Public Sub DbInfo()

Dim varWork As Variant
varWork = Split(CurrentProject.Name, ".")
Debug.Print "Name: " & varWork(0)
Debug.Print "Ext: " & varWork(1)
Debug.Print "Path: " & CurrentProject.Path & "\"

End Sub

If you're using Access 97, CurrentDb.Name will give the full path and name,
including extension, and you can parse it from there.
 
Back
Top