Bonjour à tous
Ma clause WHERE fonctionne bien un Critère à la fois,mais quand je réunis les 3 critères par AND j'ai le Message "Erreur13 : incompatibilité de Type
Je ne trouve pas la subtilité de l'erreur 13 !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 Dim intNbrJoursAbattTrouvesARS As Integer Dim strCriteria1 As String Dim strCriteria2 As String Dim strCriteria3 As String Dim usVeilleDateDebutAbsCG As String 'si le PremierJour du mois ça donne le DernierJour du MoisPrécédent usVeilleDateDebutAbsCG = "#" & Format(DateDebutAbsCG - 1, " mm / dd / yyyy " & "#") 'MsgBox usVeilleDateDebutAbsCG Affiche: #09/30/2011# strCriteria1 = "Cle_Resident = " & Forms![F1_UnResidentMajAbsences]![Cle_RESIDENT] MsgBox strCriteria1 Affiche: Cle_Resident = 1 strCriteria2 = "DateFinAbsCG = " & usVeilleDateDebutAbsCG MsgBox strCriteria2 Affiche: DateFinAbsCG = #09/30/2011# strCriteria3 = "MotifAbsence = 'Hôpital' " MsgBox strCriteria3 Affiche: MotifAbsence = 'Hôpital' 'Réunir les 3 critères pour remonter le Nombre de Jours intNbrJoursAbattTrouvesARS = DLookup("[NbrJoursAbattARS]", "T_ABSENCES", strCriteria1 And strCriteria2 And strCriteria3) MsgBox intNbrJoursAbattTrouvesARS
car pour le test je suis sûr que l'Enregistrement qui réuni les 3 Critères existe
Je gèrerer le Null dés le problème résolu
Si vous avez une idée.....
Bien cordialement
Partager