tschrec said:
Is there a command or command stream in Access that will allow a database to
be opened only from a specific file location? I would like to prevent people
from opening a database from a network drive and limit opening only from the
hard drive of the PC they are logged on to.
I tried something recently which was fairly simple. I created a file
named not_from_here in the same folder as the database. Then this
function checks whether the file is present and displays a notice and
quits the database if the file is found.
Public Function LocationCheck()
Const strFile As String = "not_from_here"
If Len(Dir(CurrentProject.Path & Chr(92) & strFile)) > 0 Then
MsgBox "Please do not open this database from this location" & _
vbNewLine & "Copy it to your local drive and open the copy."
Application.Quit
End If
End Function
I created an autoexect macro to call the function. You could call it
from a startup form instead. Either way, it can be defeated by a
knowledgeable user who holds down the shift key when starting the
database. You would have to disable the shift bypass to prevent that.