Thank you all for your assistance
I was able to find a procedure that returns the directory string. From that
I did a search on the string for C:
The problem we were having was that users were improperly creating shortucts
(drag and drop) to their desktops. They didn't realize that they were no
longer accessing the live database.. bad, bad, bad. LOL
Anyway, here's the solution:
This code I placed in a Module and named the Module DIRECTORIES
'******************** Code Begin ****************
'Code courtesy of
'Terry Kreft & Ken Getz
'
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
'******************** Code End ****************
I have a Splash form that is set to open on Startup. This form runs the
following code on open:
'.........................Start Code........................................
Private Sub Form_Open(Cancel As Integer)
Dim SearchString, SearchChar, Shortcut
Dim Path As String
Path = CurrentDBDir()
SearchString = Path ' String to search in.
SearchChar = "C:" ' Search for "C:".
' A textual comparison starting at position 4. Returns 6.
Shortcut = InStr(1, SearchString, SearchChar, 1)
If Shortcut > 0 Then
MsgBox "The shortcut you are using was created improperly." & Chr(13) & _
"Please access the database via this path:" & Chr(13) & "S:\Associate
Information\Manager Information\Operations PTP 5.0.mdb" & Chr(13) & _
"Once in the database, you may select the Create Shortcut option to create a
proper shortcut to this database.", vbCritical, "Access Not Allowed"
DoCmd.Quit
Else
Exit Sub
End If
End Sub
'.......................................End
Code..................................
Thanks again!
-- Sandy