Erreur 13 sur modifications propriétés de démarrage
Bonjour à tous
Voulant tester une fonction de modification des menus de démarrage par Vba, j'ai introduit la fonction suivante
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
Private Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Boolean
Dim db As Database
Dim prp As Property
Const conPropNotFoundError = 3270 'erreur si propriété existe
On Error GoTo Change_Err
Set db = CurrentDb
db.Properties(strPropName) = varPropValue
ChangeProperty = True
Exit Function
Change_Err:
If Err = conPropNotFoundError Then 'crèe la propriété
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Resume Next
Else
ChangeProperty = False
Exit Function
End If
End Function |
Pour tester cette fonction j'ai supprimé une propriété par
Code:
1 2
|
myDatabase.Properties.Delete "AllowFullMenus" |
Puis j'ai lancé ma fonction par
Code:
1 2 3 4
|
Public Function CreateProperty()
Call ChangeProperty("AllowFullMenus", dbBoolean, False)
End Function |
Or j'ai une erreur 13 "Incompatibilité de type" sur la ligne
Code:
1 2
|
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue |
J'ai beau chercher, je ne trouve pas l'erreur. Y a t'il une référence particulière à ajouter?
D'avance merci à tous.