Daniel,
Unless you disable the shift key bypass, users can bypass
the startup form mentioned in my above post. You can
disable the shift key bypass using the below function as
follows:
1) Add this procedure to a module in your front end.
2) Make a back up copy of your front end.
3) Execute this code to disable the shift key bypass:
fnDisableSKBypass "YourDatabaseName", False
To re-enable the shift key bypass just change the False to
True.
Here's the function adapted from the Security FAQ:
Function fnDisableSKBypass(strDBName As String, blnAllow
As Boolean) As Boolean
On Error GoTo Err_fnDisableSKBypass
Dim WS As DAO.Workspace
Dim DB As DAO.Database
Dim Prop As DAO.Property
Const conPropNotFound = 3270
Set WS = DBEngine.Workspaces(0)
Set DB = WS.OpenDatabase(strDBName)
DB.Properties("AllowByPassKey") = Not blnAllow
fnDisableSKBypass = blnAllow
Exit_fnDisableSKBypass:
On Error Resume Next
Set WS = Nothing
Set DB = Nothing
Set Prop = Nothing
Exit Function
Err_fnDisableSKBypass:
' The AllowBypassKey property is a user-defined
property of the database that must
' be created before it can be set. This error code
will execute the first time this
' function is run in a database.
If Err = conPropNotFound Then
' You must set the fourth DDL parameter to True to
ensure that only administrators
' can modify it later. If it was created wrongly, then
delete it and re-create it
' correctly.
Set Prop = DB.CreateProperty("AllowByPassKey",
dbBoolean, False, True)
DB.Properties.Append Prop
Resume
Else
MsgBox "Error #: " & vbTab & vbTab & Err.Number &
vbCrLf _
& "Description: " & vbTab & Err.Description
fnDisableSKBypass = False
End If
Resume Exit_fnDisableSKBypass
End Function
-----Original Message-----
Daniel,
I believe the simplest way to do this is as follows:
1) Copy and paste the code from the below link into a new
module in your front end application.
http://www.mvps.org/access/api/api0009.htm
2) Set up startup form via Tools/Startup... Often this
form is a switchboard form. In the Startup... dialog,
select the form from the "Display Form/Page" combo box and
click OK.
3) Now open the form in design view and go into the
form's property dialog. In the form's Open event
property, select "[Event Procedure]", and click on the
ellipsis button (...).
4) Enter the below code in the procedure:
If fOSMachineName() = "YourComputerName" Then
Beep
MsgBox "You are not authorized to connect to the
database from this" _
& " machine." _
& vbCrLf & vbCrLf _
& "Your session will now be disconnected.", _
vbCritical, "Connection Not Allowed"
Application.Quit
End If
I know of another way that checks both the user's login ID
and the computer name. I can post that one too if you
want it.
-----Original Message-----
Hello,
Is there a way and if so how... can I use code to verify the active computer
that is trying to open a database? I would like to install a database on a
pre-determined computer and set it up so that no other computers can open it.
What unique identifier can I use?! What coding can I
use
to verify it upon
opening the database? I need a step by step on this one if possible.
Thanking you for the advise in advance,
Daniel
.
.