I have the following code on a popup form in an access project:
The form has two check boxes to select enable/disable shift, and a password box for the user to enter a code to verify they didnt find the poopup by accideny ;p
---
If PasswordBox = "abcde" Then
Dim db As Database
If Action.Value = 1 Then
'This Code Disables the Shift Key
Dim prp As Property
Set db = CurrentDb
Set prp = db.CreateProperty("AllowByPassKey", dbBoolean, False)
db.Properties.Append prp
'********************************************************
MsgBox "Database Locked", 0, "Yay!"
Else
'This Code Re-enables the Shift Key
Set db = CurrentDb
db.Properties.Delete "AllowByPassKey"
db.Properties.Refresh
'********************************************************
MsgBox "Database Unlocked", 0, "Yay!"
End If
Else
MsgBox "You Entered The Wrong Password!", 0, "Error!"
End If
---
The error i get is "Object Variable or With Block Variable not set"
breaking on the line:
Set prp = db.CreateProperty("AllowByPassKey", dbBoolean, False)
or:
db.Properties.Delete "AllowByPassKey"
depending on which option was selected
Yes is do have DAO 3.5 set in my referances before anyone asks, and im working with an Access 2000 Project linking to a SQL server backend.
I dont want users sneaking into the server backend, i have locked down everything else but the shift at startup button.
The form has two check boxes to select enable/disable shift, and a password box for the user to enter a code to verify they didnt find the poopup by accideny ;p
---
If PasswordBox = "abcde" Then
Dim db As Database
If Action.Value = 1 Then
'This Code Disables the Shift Key
Dim prp As Property
Set db = CurrentDb
Set prp = db.CreateProperty("AllowByPassKey", dbBoolean, False)
db.Properties.Append prp
'********************************************************
MsgBox "Database Locked", 0, "Yay!"
Else
'This Code Re-enables the Shift Key
Set db = CurrentDb
db.Properties.Delete "AllowByPassKey"
db.Properties.Refresh
'********************************************************
MsgBox "Database Unlocked", 0, "Yay!"
End If
Else
MsgBox "You Entered The Wrong Password!", 0, "Error!"
End If
---
The error i get is "Object Variable or With Block Variable not set"
breaking on the line:
Set prp = db.CreateProperty("AllowByPassKey", dbBoolean, False)
or:
db.Properties.Delete "AllowByPassKey"
depending on which option was selected
Yes is do have DAO 3.5 set in my referances before anyone asks, and im working with an Access 2000 Project linking to a SQL server backend.
I dont want users sneaking into the server backend, i have locked down everything else but the shift at startup button.