AllowByPassKey

J

John

Hi,
I have found several methods to implement a form which will secure/unsecure
my DB.
However, I am struggling to make this work.
I am using access 2007, would this make a difference?
Any help here would be most appreciated.


Code to Secure is

------------------

Public Function SetAllowBypassKeyFalse()
On Error GoTo Err_SetAllowBypassKeyFalse
Dim db As DAO.Database, prp As DAO.Property
Set db = CurrentDb
db.Properties("AllowBypassKey") = False
Set db = Nothing
Exit_SetAllowBypassKeyFalse:
Exit Function
Err_SetAllowBypassKeyFalse:
If Err = 3270 Then
Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, False)
db.Properties.Append prp
Resume Next
Else
MsgBox "SetAllowBypassKeyFalse", Err.Number, Err.Description
Resume Exit_SetAllowBypassKeyFalse
End If
End Function
---------------------

Code to UnSecure is

---------------------
Public Function SetAllowBypassTrue()
On Error GoTo Err_SetAllowBypassKeyTrue
Dim db As DAO.Database, prp As DAO.Property
Set db = CurrentDb
db.Properties("AllowBypassKey") = True
Set db = Nothing
Exit_SetAllowBypassKeyTrue:
Exit Function
Err_SetAllowBypassKeyTrue:
If Err = 3270 Then
Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, True)
db.Properties.Append prp
Resume Next
Else
MsgBox "SetAllowBypassKeyFalse", Err.Number, Err.Description
Resume Exit_SetAllowBypassKeyTrue
End If
End Function
 
B

Boyd Trimmell aka HiTechCoach via AccessMonster.co

John

Are you getting any error messages?

Did you make sure you have the reference to the DAO library selected?
Hi,
I have found several methods to implement a form which will secure/unsecure
my DB.
However, I am struggling to make this work.
I am using access 2007, would this make a difference?
Any help here would be most appreciated.

Code to Secure is

------------------

Public Function SetAllowBypassKeyFalse()
On Error GoTo Err_SetAllowBypassKeyFalse
Dim db As DAO.Database, prp As DAO.Property
Set db = CurrentDb
db.Properties("AllowBypassKey") = False
Set db = Nothing
Exit_SetAllowBypassKeyFalse:
Exit Function
Err_SetAllowBypassKeyFalse:
If Err = 3270 Then
Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, False)
db.Properties.Append prp
Resume Next
Else
MsgBox "SetAllowBypassKeyFalse", Err.Number, Err.Description
Resume Exit_SetAllowBypassKeyFalse
End If
End Function
---------------------

Code to UnSecure is

---------------------
Public Function SetAllowBypassTrue()
On Error GoTo Err_SetAllowBypassKeyTrue
Dim db As DAO.Database, prp As DAO.Property
Set db = CurrentDb
db.Properties("AllowBypassKey") = True
Set db = Nothing
Exit_SetAllowBypassKeyTrue:
Exit Function
Err_SetAllowBypassKeyTrue:
If Err = 3270 Then
Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, True)
db.Properties.Append prp
Resume Next
Else
MsgBox "SetAllowBypassKeyFalse", Err.Number, Err.Description
Resume Exit_SetAllowBypassKeyTrue
End If
End Function
----------------------

Regards

John

--
Boyd Trimmell
aka HiTechCoach
http://www.hitechcoach.com
http://www.officeprogramming.com

Message posted via AccessMonster.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Disable ByPass Key 7
disable shift key 2
Check status db.Properties 1
AllowByPassKey 6
Disable/Enable the Shift Bypass Key 3
AllowBypass Key 6
del 2003 al 2000 2
Function to disable/enable the shift bypass key 2

Top