Ive searched here but didnt find an answer. Ive had to make one of my own, but i thought maybe others might find this solution usefull. I needed to get just the name / title of the database not the full path but Access 97 doesnt have the 'InStrRev' function , thats why i needed to do this. Its a bit grubby but it works for me, if anyone can make it neater and more efficient, please feel free to do so.
Function GetDB_Name()
Dim DbNameString
Dim What2Look4
'gets the length of the database name
'i.e. C:\my drive\my database.mdb
DbNameString = InStr(1, CurrentDb.Name, ".mdb")
What2Look4 = Mid(CurrentDb.Name, DbNameString - 1, 1)
'loop until the last backslash in the database name is found
Do Until What2Look4 = "\"
FDbNameString = DbNameString - 1
What2Look4 = Mid(CurrentDb.Name, DbNameString, 1)
Loop
MsgBox Mid(CurrentDb.Name, DbNameString + 1, DbNameString)
End Function
"Children are smarter than any of us. Know how I know that? I don't know one child with a full time job and children."...Bill Hicks
Function GetDB_Name()
Dim DbNameString
Dim What2Look4
'gets the length of the database name
'i.e. C:\my drive\my database.mdb
DbNameString = InStr(1, CurrentDb.Name, ".mdb")
What2Look4 = Mid(CurrentDb.Name, DbNameString - 1, 1)
'loop until the last backslash in the database name is found
Do Until What2Look4 = "\"
FDbNameString = DbNameString - 1
What2Look4 = Mid(CurrentDb.Name, DbNameString, 1)
Loop
MsgBox Mid(CurrentDb.Name, DbNameString + 1, DbNameString)
End Function
"Children are smarter than any of us. Know how I know that? I don't know one child with a full time job and children."...Bill Hicks