Finding Current mdb or mde name & folder

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
 
B

Brendan Reynolds

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top