AllowByPassKey

  • Thread starter Thread starter John
  • Start date Start date
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
 
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
 
Back
Top