Erreur éxécution94 Utilisation incorecte NULL
Primo60
Messages postés
6
Statut
Membre
-
blux Messages postés 2046 Date d'inscription Statut Modérateur Dernière intervention -
blux Messages postés 2046 Date d'inscription Statut Modérateur Dernière intervention -
Bonjour,
Alors je me permets de poster mon problème ici. Je préviens de suite que je ne suis pas une spécialiste du VBA.
J'ai un problème avec un fichier ACCESS que mon prédécesseur à créé.
Quand je suis dans un champ pour rentrer des dates, Access me sort "erreur d'exécution 94 utilisation incorrecte null "
Else
[COLOR="Red"] For i = 1 To [Dleap][/COLOR]
[EnvoiAppPrev] = [EnvoiAppPrev] + 1
If WeekDay([EnvoiAppPrev]) = 7 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 2
C'est la ligne en question qui pose problème. Je ne sais pas trop ce qu'il faudrait que je vous mette pour que vous puissiez comprendre d'où viens le problème.
Le plus bizarre dans tout ça, c'est que cela fonctionnait très bien et d'une saisie à l'autre le problème est apparu...
Merci d'avance et n'hésitez pas à me demander d'autres informations.
Alors je me permets de poster mon problème ici. Je préviens de suite que je ne suis pas une spécialiste du VBA.
J'ai un problème avec un fichier ACCESS que mon prédécesseur à créé.
Quand je suis dans un champ pour rentrer des dates, Access me sort "erreur d'exécution 94 utilisation incorrecte null "
Else
[COLOR="Red"] For i = 1 To [Dleap][/COLOR]
[EnvoiAppPrev] = [EnvoiAppPrev] + 1
If WeekDay([EnvoiAppPrev]) = 7 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 2
C'est la ligne en question qui pose problème. Je ne sais pas trop ce qu'il faudrait que je vous mette pour que vous puissiez comprendre d'où viens le problème.
Le plus bizarre dans tout ça, c'est que cela fonctionnait très bien et d'une saisie à l'autre le problème est apparu...
Merci d'avance et n'hésitez pas à me demander d'autres informations.
4 réponses
-
Salut,
valeur de Dleap ?
A+ Blux"Les cons, ça ose tout. C'est même à ça qu'on les reconnait"
-
Merci Blux pour ta réponse rapide. Je suis désolée mais je ne sais pas où trouver ça. Moi même je ne sais pas à quoi cela fait référence...
Je sais, je ne t'aide pas non plus^^
Je ne sais pas non plus quoi poster pour pouvoir t'éclairer plus :s -
[Dleap] = Null
Je vais te poster du code, qui pour moi correspond à la "fonction" complète. C'est un peu long, désolée...
Private Sub EmisReel_Exit(Cancel As Integer)
If IsDate([EmisReel]) Then
[EnvoiAppPrev] = [EmisReel]
If WeekDay([EnvoiAppPrev]) = 7 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 2
End If
If WeekDay([EnvoiAppPrev]) = 1 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 1
End If
If Dleap = 0 Then
[EnvoiAppReel] = [EnvoiAppPrev]
Else
For i = 1 To [Dleap]
[EnvoiAppPrev] = [EnvoiAppPrev] + 1
If WeekDay([EnvoiAppPrev]) = 7 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 2
End If
If Month([EnvoiAppPrev]) = 1 Then
If Day([EnvoiAppPrev]) = 1 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 1
If WeekDay([EnvoiAppPrev]) = 7 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 2
End If
End If
End If
If Month([EnvoiAppPrev]) = 5 Then
If Day([EnvoiAppPrev]) = 1 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 1
If WeekDay([EnvoiAppPrev]) = 7 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 2
End If
End If
End If
If Month([EnvoiAppPrev]) = 7 Then
If Day([EnvoiAppPrev]) = 14 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 1
If WeekDay([EnvoiAppPrev]) = 7 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 2
End If
End If
End If
If Month([EnvoiAppPrev]) = 8 Then
If Day([EnvoiAppPrev]) = 15 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 1
If WeekDay([EnvoiAppPrev]) = 7 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 2
End If
End If
End If
If Month([EnvoiAppPrev]) = 11 Then
If Day([EnvoiAppPrev]) = 11 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 1
If WeekDay([EnvoiAppPrev]) = 7 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 2
End If
End If
End If
If Month([EnvoiAppPrev]) = 12 Then
If Day([EnvoiAppPrev]) = 25 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 1
If WeekDay([EnvoiAppPrev]) = 7 Then
[EnvoiAppPrev] = [EnvoiAppPrev] + 2
End If
End If
End If
Next
End If
[RetourAppPrev] = [EnvoiAppPrev]
If [DlApp] = 0 Then
Else
For i = 1 To [DlApp]
[RetourAppPrev] = [RetourAppPrev] + 1
If WeekDay([RetourAppPrev]) = 7 Then
[RetourAppPrev] = [RetourAppPrev] + 2
End If
If Month([RetourAppPrev]) = 1 Then
If Day([RetourAppPrev]) = 1 Then
[RetourAppPrev] = [RetourAppPrev] + 1
If WeekDay([RetourAppPrev]) = 7 Then
[RetourAppPrev] = [RetourAppPrev] + 2
End If
End If
End If
If Month([RetourAppPrev]) = 5 Then
If Day([RetourAppPrev]) = 1 Then
[RetourAppPrev] = [RetourAppPrev] + 1
If WeekDay([RetourAppPrev]) = 7 Then
[RetourAppPrev] = [RetourAppPrev] + 2
End If
End If
End If
If Month([RetourAppPrev]) = 7 Then
If Day([RetourAppPrev]) = 14 Then
[RetourAppPrev] = [RetourAppPrev] + 1
If WeekDay([RetourAppPrev]) = 7 Then
[RetourAppPrev] = [RetourAppPrev] + 2
End If
End If
End If
If Month([RetourAppPrev]) = 8 Then
If Day([RetourAppPrev]) = 15 Then
[RetourAppPrev] = [RetourAppPrev] + 1
If WeekDay([RetourAppPrev]) = 7 Then
[RetourAppPrev] = [RetourAppPrev] + 2
End If
End If
End If
If Month([RetourAppPrev]) = 11 Then
If Day([RetourAppPrev]) = 11 Then
[RetourAppPrev] = [RetourAppPrev] + 1
If WeekDay([RetourAppPrev]) = 7 Then
[RetourAppPrev] = [RetourAppPrev] + 2
End If
End If
End If
If Month([RetourAppPrev]) = 12 Then
If Day([RetourAppPrev]) = 25 Then
[RetourAppPrev] = [RetourAppPrev] + 1
If WeekDay([RetourAppPrev]) = 7 Then
[RetourAppPrev] = [RetourAppPrev] + 2
End If
End If
End If
Next
End If
[DateNotifPrev] = [RetourAppPrev]
If [DlSyn] = 0 Then
Else
For i = 1 To [DlSyn]
[DateNotifPrev] = [DateNotifPrev] + 1
If WeekDay([DateNotifPrev]) = 7 Then
[DateNotifPrev] = [DateNotifPrev] + 2
End If
If Month([DateNotifPrev]) = 1 Then
If Day([DateNotifPrev]) = 1 Then
[DateNotifPrev] = [DateNotifPrev] + 1
If WeekDay([DateNotifPrev]) = 7 Then
[DateNotifPrev] = [DateNotifPrev] + 2
End If
End If
End If
If Month([DateNotifPrev]) = 5 Then
If Day([DateNotifPrev]) = 1 Then
[DateNotifPrev] = [DateNotifPrev] + 1
If WeekDay([DateNotifPrev]) = 7 Then
[DateNotifPrev] = [DateNotifPrev] + 2
End If
End If
End If
If Month([DateNotifPrev]) = 7 Then
If Day([DateNotifPrev]) = 14 Then
[DateNotifPrev] = [DateNotifPrev] + 1
If WeekDay([DateNotifPrev]) = 7 Then
[DateNotifPrev] = [DateNotifPrev] + 2
End If
End If
End If
If Month([DateNotifPrev]) = 8 Then
If Day([DateNotifPrev]) = 15 Then
[DateNotifPrev] = [DateNotifPrev] + 1
If WeekDay([DateNotifPrev]) = 7 Then
[DateNotifPrev] = [DateNotifPrev] + 2
End If
End If
End If
If Month([DateNotifPrev]) = 11 Then
If Day([DateNotifPrev]) = 11 Then
[DateNotifPrev] = [DateNotifPrev] + 1
If WeekDay([DateNotifPrev]) = 7 Then
[DateNotifPrev] = [DateNotifPrev] + 2
End If
End If
End If
If Month([DateNotifPrev]) = 12 Then
If Day([DateNotifPrev]) = 25 Then
[DateNotifPrev] = [DateNotifPrev] + 1
If WeekDay([DateNotifPrev]) = 7 Then
[DateNotifPrev] = [DateNotifPrev] + 2
End If
End If
End If
Next
End If
If IsDate([EmisPrev]) Then
If IsDate([EmisReel]) Then
[Ecart] = [EmisReel] - [EmisPrev]
Else
[Ecart] = Now - [EmisPrev]
End If
If [Ecart] < 0 Then
[Ecart] = 0
End If
End If
If IsDate([EnvoiAppPrev]) Then
If [Dleap] > 0 Then
If IsDate([EnvoiAppReel]) Then
[RetEap] = [EnvoiAppReel] - [EnvoiAppPrev]
Else
[RetEap] = Now - [EnvoiAppPrev]
End If
If [RetEap] < 0 Then
[RetEap] = 0
End If
Else
[RetEap] = 0
End If
End If
End If
End Sub-
Il est donc plus que probable que dleap n'aie pas de valeur.
Et comme il n'est prévu nulle part qu'il puisse avoir la valeur 'null', l'application plante.
Je modifierais peut-être le code pour ajouter ce test et le traiter de la même façon que s'il avait une valeur à 0, mais il faut connaître le code et toutes ses implications : d'où vient cette variable et à quoi sert-elle ?
Un truc comme ça :
If (isnull(Dleap) or Dleap = 0) Then [EnvoiAppReel] = [EnvoiAppPrev]
-
-
Peut on voir ça par mail ou messagerie? Car là comme ça je ne vois pas trop comment on peux faire :s
Je suis désolée, je suis vraiment une novice là dedans mais j'ai vraiment besoin de régler ce problème....