J
Jim Bonacorda
I am attempting to set the AllowBypassKey property to
false in an mde file, but it does not seem to work. Any
advice is appreciated.
Below is the code I am using:
Sub KeepEmOut()
On Error GoTo SubErr
Const INVALID_PROPERTY_REFERENCE As Integer = 2455
Const ITEM_NOT_FOUND As Integer = 3265
Const PROPERTY_NOT_FOUND As Integer = 3270
Dim dbs As dao.Database
Dim Prpty As dao.Property
Dim strErrMsg, strMsg As String
Set dbs = CurrentDb
' delete property if it exists
dbs.Properties.Delete "AllowBypassKey"
' re-create property,
Set Prpty = dbs.CreateProperty("AllowBypassKey", 1,
False, True)
dbs.Properties.Append Prpty
dbs.Properties.Refresh
SubExit:
Exit Sub
SubErr:
If Err.Number = 3265 Or Err.Number = 3270 Or
Err.Number = 2455 Then
' we can ignore when the prop does not exist
Resume Next
Else
strErrMsg = "Error # " & Err.Number & Chr(13) &
Err.Description
MsgBox strErrMsg, vbCritical, "ERROR"
Resume SubExit
End If
End Sub
Regards,
Jim Bonacorda
false in an mde file, but it does not seem to work. Any
advice is appreciated.
Below is the code I am using:
Sub KeepEmOut()
On Error GoTo SubErr
Const INVALID_PROPERTY_REFERENCE As Integer = 2455
Const ITEM_NOT_FOUND As Integer = 3265
Const PROPERTY_NOT_FOUND As Integer = 3270
Dim dbs As dao.Database
Dim Prpty As dao.Property
Dim strErrMsg, strMsg As String
Set dbs = CurrentDb
' delete property if it exists
dbs.Properties.Delete "AllowBypassKey"
' re-create property,
Set Prpty = dbs.CreateProperty("AllowBypassKey", 1,
False, True)
dbs.Properties.Append Prpty
dbs.Properties.Refresh
SubExit:
Exit Sub
SubErr:
If Err.Number = 3265 Or Err.Number = 3270 Or
Err.Number = 2455 Then
' we can ignore when the prop does not exist
Resume Next
Else
strErrMsg = "Error # " & Err.Number & Chr(13) &
Err.Description
MsgBox strErrMsg, vbCritical, "ERROR"
Resume SubExit
End If
End Sub
Regards,
Jim Bonacorda