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 40 41 42 43 44 45 46 47 48 49 50
| Option Compare Database
Option Explicit
' Bouton pour activer MAJ
Private Sub CmdActiverMAJ_Click()
' Appel Sub UnSetBypassProperty de la faq
UnSetBypassProperty
End Sub
' Bouton pour desactiver MAJ
Private Sub CmdDesactiverMAJ_Click()
' Appel Sub SetBypassProperty de la faq
SetBypassProperty
End Sub
' ---------------------------------------------------------
' code de la faq - DEBUT
' ---------------------------------------------------------
Sub SetBypassProperty()
Const DB_Boolean As Long = 1
ChangeProperty "AllowBypassKey", DB_Boolean, False
End Sub
Sub UnSetBypassProperty()
Const DB_Boolean As Long = 1
ChangeProperty "AllowBypassKey", DB_Boolean, True
End Sub
Function ChangeProperty(strPropName As String, varPropType As Long, varPropValue As Variant) As Integer
Dim dbs As Database, prp As Variant
Const conPropNotFoundError = 3270
Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Propriété non trouvée.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' --Erreur inconnue.
Resume Change_Bye
End If
End Function
' ---------------------------------------------------------
' code de la faq - FIN
' --------------------------------------------------------- |
Partager