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
| Il est intéressant des fois d'inhiber l'effet de la touche MAJ (Ne pas exécuter les évènement de chargement de la base) pour ne pas afficher le conteneur de la base à l'utilisateur. Pour cela on dispose de deux procédures, l'une qui l'inhibe SetBypassProperty, l'autre qui l'active UnSetBypassProperty.
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 |
Partager