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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
| Public Sub SetStartOptions()
Call ChangeProperty("AllowFullMenus", False)
Call ChangeProperty("AllowBypassKey", False)
Call ChangeProperty("StartUpShowDBWindow", False)
Call ChangeProperty("AllowBuiltInToolbars", False)
Call ChangeProperty("AllowShortcutMenus", True)
Call ChangeProperty("AllowToolbarChanges", False)
Call ChangeProperty("AllowSpecialKeys", False)
End Sub
Public Sub UnsetStartOptions()
Call ChangeProperty("AllowFullMenus", True)
Call ChangeProperty("AllowBypassKey", True)
Call ChangeProperty("StartUpShowDBWindow", False)
Call ChangeProperty("AllowBuiltInToolbars", True)
Call ChangeProperty("AllowShortcutMenus", True)
Call ChangeProperty("AllowToolbarChanges", True)
Call ChangeProperty("AllowSpecialKeys", True)
End Sub
Private Function ChangeProperty(strPropName As String, _
varPropValue As Variant) As Boolean
' Exemples d'appels
'#######################
'Call ChangeProperty("AllowFullMenus", True)
'Call ChangeProperty("AllowBypassKey", True)
'Call ChangeProperty("StartUpShowDBWindow", True)
'Call ChangeProperty("AllowBuiltInToolbars", True)
'Call ChangeProperty("AllowShortcutMenus", True)
'Call ChangeProperty("AllowToolbarChanges", True)
'Call ChangeProperty("AllowSpecialKeys", True)
''Propriétés Explications
'###############
''AllowFullMenu
'Vous n'aurez plus accès aux fonctionnalités d'Access. Plus aucune option n'est disponible.
''AllowBypassKey
'Vous ne pourrez plus utiliser la touche Shift pour intercepter les procédures de démarrage.
''StartupShowDBWindow
'Vous n'aurez plus accès aux objets de votre base de données.
''AllowBuiltInToolbars
'Vous ne pourrez plus afficher les barres d'outils intégrés.
''AllowShortcutMenus
'Les menus contextuels personnalisés ne sont plus autorisés.
''AllowToolbarChanges
'Vous ne pourrez plus modifier les barres de menus et menus contextuels.
''AllowSpecialKeys
'Vous ne pourrez plus utiliser les touches spéciales d'accès.
Dim varPropType As Variant
'liste des propriétés de démarrage disponibles:
Select Case strPropName
Case "AppTitle"
varPropType = dbText
Case "AllowFullMenus"
varPropType = dbBoolean
Case "AllowBypassKey"
varPropType = dbBoolean
Case "StartUpShowDBWindow" 'Fenêtre de base de données
varPropType = dbBoolean
Case "StartUpShowStatusBar" 'Masquer la barre d'Etat
varPropType = dbBoolean
Case "AllowBuiltInToolbars"
varPropType = dbBoolean
Case "AllowShortcutMenus"
varPropType = dbBoolean
Case "AllowToolbarChanges"
varPropType = dbBoolean
Case "AppIcon"
varPropType = dbText
Case "StartUpForm"
varPropType = dbText
Case "StartUpShortcutMenuBar"
varPropType = dbText
Case "StartUpMenuBar"
varPropType = dbText
Case "AllowSpecialKeys"
varPropType = dbBoolean
Case "AllowBreakIntoCode"
varPropType = dbBoolean
End Select
Dim Dbs As DAO.Database
Dim prp As Variant
Const errPropNotFoundError = 3270
Set Dbs = CurrentDb
On Error GoTo Change_Err
Dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Change_Exit:
Set prp = Nothing
Set Dbs = Nothing
'rafraîchissement de la barre de titre pour prendre en compte le nouveau titre et/ou icône
RefreshTitleBar
Exit Function
Change_Err:
If err = errPropNotFoundError Then ' 3270 = Propriété non trouvée.
Debug.Print "pté non trouvée : " & strPropName
'Création de la propriété:
Set prp = Dbs.CreateProperty(strPropName, varPropType, varPropValue)
Dbs.Properties.Append prp
Resume Next
Else
' Erreur inconnue.
ChangeProperty = False
MsgBox err.Description & err.Number
Resume Change_Exit
End If
End Function |
Partager