3 pièce(s) jointe(s)
stLinkCriteria avec 2 critrères KO
Bonjour à tous,
Je m’énerve depuis 2 heures sur un problème bête,
J"ai un code du genre ;
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
SID_jalon = Me.id_jalon
SID_mode_fact = Me.id_mode_fact
stLinkCriteria = "[id_nom_jalon]='" & SID_jalon & "'"
If DCount("id", "T_jalons_factus", _
stLinkCriteria) > 0 Then
...
...
Endif |
Sauf que dans mon critère de recherche, je veux mettre 2 conditions
Donc j’essaye
Code:
stLinkCriteria = "[id_nom_jalon]='" & SID_jalon & "'" & " And [id_mode_fact]='" & SID_mode_fact & "'"
Pour info, ma table est définie comme suit :
Pièce jointe 635690
Quans j'exécute, si je regarde la valeur de stLinkCriteria j'ai bien ce que je pense être bon
"[id_jalon]='1' And [id_mode_fact]='1'"
Mmais à la ligne d'en dessous , ça plante et j'ai cette erreur
Pièce jointe 635691
Je précise que avec 1 seul critère ça fonctionne mais ce n'est pas ce que je veux !
SOS, ça ne me parle pas du tout, qui aurait une idée,
-----------------
Et j'ai ensuite un autre souci sur le même sujet :
mon code entier est
Code:
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
| Dim SID As String
Dim stLinkCriteria As String
Dim rsc As DAO.Recordset
Set rsc = Me.RecordsetClone
SID_jalon = Me.id_jalon
SID_mode_fact = Me.id_mode_fact
stLinkCriteria = "[id_nom_jalon]='" & SID_jalon & "'"
' stLinkCriteria = "[id_nom_jalon]='" & SID_jalon & "'" & " And [id_mode_fact]='" & SID_mode_fact & "'"
'Check StudentDetails table for duplicate StudentNumber
If DCount("id", "T_jalons_factus", _
stLinkCriteria) > 0 Then
'Undo duplicate entry
Me.Undo
'Message box warning of duplication
MsgBox "Le jalon selectionné existe déja pour ce mode de facturations." _
& vbCr & vbCr & _
"Merci de faire les modificationssur celui qui existe déjà ou en selectionner un autre.", _
vbInformation, "Duplicate Information"
'Go to record that alreadyexists
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
End If |
à l'exécution de la ligne rsc.FindFirst stLinkCriteria
j'ai l'errur suivante que je ne comprend pas non plus , je me sens idiot :(:calim2::calim2:
Pièce jointe 635696
Merci;
@+