Hi
I using the CurrentDB.Name function to check the filepath of a database to make sure that the users are using the network version (a problem caused by the previous developer meant that some users were working off standalone copies of the db rather than the network copy!!). This seems to be working for all users except one. She is definately opening the network version (I can see the changes she has made) but the Currentdb.Name statement is returning a different filepath.
True file path: "N:\TrustCancelledOps\Cancel2001.mdb"
CurrentDB.Name returns: "N:\TrustC~1\Cancel2001.mdb"
Does anyone know why this is happening or how I can workaround it? Thanks in advance.
Code (in Form_Open event of Form which runs off autoexec):
Dim strFilePath As String
strFilePath = CurrentDb.Name
If strFilePath Like "N:\TrustCancelledOps\Cancel2001.mdb" Then
Exit Sub 'if correct path/filename then no action needed
Else
MsgBox "The database is in the filepath " & strFilePath & " and is therefore not the live database. " & vbCrLf & _
"Please exit the database and contact the database administrator on 66477 for access to the correct database.", vbCritical, "Warning: Invalid Database File."
Cancel = True 'don't open this form (which tells them they are in live database) as they are not in live database
End If
I using the CurrentDB.Name function to check the filepath of a database to make sure that the users are using the network version (a problem caused by the previous developer meant that some users were working off standalone copies of the db rather than the network copy!!). This seems to be working for all users except one. She is definately opening the network version (I can see the changes she has made) but the Currentdb.Name statement is returning a different filepath.
True file path: "N:\TrustCancelledOps\Cancel2001.mdb"
CurrentDB.Name returns: "N:\TrustC~1\Cancel2001.mdb"
Does anyone know why this is happening or how I can workaround it? Thanks in advance.
Code (in Form_Open event of Form which runs off autoexec):
Dim strFilePath As String
strFilePath = CurrentDb.Name
If strFilePath Like "N:\TrustCancelledOps\Cancel2001.mdb" Then
Exit Sub 'if correct path/filename then no action needed
Else
MsgBox "The database is in the filepath " & strFilePath & " and is therefore not the live database. " & vbCrLf & _
"Please exit the database and contact the database administrator on 66477 for access to the correct database.", vbCritical, "Warning: Invalid Database File."
Cancel = True 'don't open this form (which tells them they are in live database) as they are not in live database
End If