1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
Sub SetBypassProperty(booArg As Boolean)
Dim varRép As VbMsgBoxResult
On Error Resume Next
Const DB_Boolean As Long = 1
If booArg = False Then
varRép = MsgBox("Desactivate <Shift> key and lock the application ? ", vbQuestion + vbYesNo, " ")
If varRép = vbNo Then Exit Sub
Else
varRép = MsgBox("Activate <Shift> key and unlock the application ? ", vbQuestion + vbYesNo, " ")
If varRép = vbNo Then Exit Sub
End If
ChangeProperty "AllowBypassKey", DB_Boolean, booArg
Call cmdCancel_Click
End Sub
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Change_Bye:
Exit Function
Change_Err:
If err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function |
Partager