Recherche multicritere entre 2 dates

cs_biloute91 Messages postés 5 Date d'inscription mardi 11 décembre 2007 Statut Membre Dernière intervention 23 mai 2008 - 23 mai 2008 à 13:58
bigfish_le vrai Messages postés 1835 Date d'inscription vendredi 13 mai 2005 Statut Membre Dernière intervention 20 novembre 2013 - 23 mai 2008 à 15:47
Bonjour,

j'ai un USF qui me permet de trouver le nombre d'éléments selon plusieurs critères. Mon problème est que lorsque je souhaite intégrer un critère de recherche supplementaire qui est la notion de temps (entre deux dates) non seulement je n'y arrive pas mais en plus cela fait bugger la recherche sur les autres critères.
Je vous joins mon code si qquelqu'un peut m'aider.
Merci

Private Sub cmdCalculer_Click()
    ' Contruction de la chaine pour calculer le nombre d'éléments
   
    Dim strSumproduct As String
   
    ' Si le critère Fruit est renseigné
    If TextBox2.Value <> "" Then        strSumproduct "((LPeri """ & TextBox2.Value & """)*1)"
    End If
   
    ' Si le critère Couleur est renseigné
    If TextBox3.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LObjet """ & TextBox3.Value & """)*1 )"
    End If
   
    ' Si le critère Qualité est renseigné
    If ComboBox2.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LTransmis """ & ComboBox2.Value & """)*1)"
    End If
      If ComboBox6.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LMeco """ & ComboBox6.Value & """)*1)"
    End If
      If ComboBox7.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LResp """ & ComboBox7.Value & """)*1)"
    End If
      If ComboBox8.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LPTF """ & ComboBox8.Value & """)*1)"
    End If
   
    If TextBox6.Value <> "" Then        strSumproduct "((LPeri """ & TextBox6.Value & """)*1)"
    End If
   
    ' Si le critère Couleur est renseigné
    If TextBox7.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LObjet """ & TextBox7.Value & """)*1 )"
    End If
   
    ' Si le critère Qualité est renseigné
    If ComboBox12.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LTransmis """ & ComboBox12.Value & """)*1)"
    End If
      If ComboBox10.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LMeco """ & ComboBox10.Value & """)*1)"
    End If
      If ComboBox11.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LResp """ & ComboBox11.Value & """)*1)"
    End If
      If ComboBox9.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LPTF """ & ComboBox9.Value & """)*1)"
    End If
      If TextBox8.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LUID  " & TextBox8.Value & " )*1 )"
    End If
   
    ' Si le critère Couleur est renseigné
    If TextBox9.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((LUID  " & TextBox9.Value & " )*1 )"
    End If
    If TextBox10.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((Ldelai  " & TextBox10.Value & " )*1 )"
    End If
    If TextBox11.Value <> "" Then
        If strSumproduct <> "" Then strSumproduct = strSumproduct & "*"        strSumproduct strSumproduct & "((Ldelai  " & TextBox11.Value & " )*1 )"
    End If
  
End If
    ' Calculer le nombre d'éléments en utilisant Evaluate
    TextBox5.Value = 0
    If strSumproduct <> "" Then
        TextBox5.Value = Evaluate("SUMPRODUCT(" & strSumproduct & ")")
    End If
End Sub

 

4 réponses

cs_Jack Messages postés 14006 Date d'inscription samedi 29 décembre 2001 Statut Modérateur Dernière intervention 28 août 2015 79
23 mai 2008 à 14:40
Quel est le rapport entre ton code (auquel je ne pige rien) et les dates ?

Vala
Jack, MVP VB
NB : Je ne répondrai pas aux messages privés

<hr />Le savoir est la seule matière qui s'accroit quand on la partage (Socrate)
0
bigfish_le vrai Messages postés 1835 Date d'inscription vendredi 13 mai 2005 Statut Membre Dernière intervention 20 novembre 2013 15
23 mai 2008 à 15:15
Salut,

pas mieux !

A+

_________________________________________________________________________________________
La connerie est la seul matiere qui s'accroit meme quand on la partage pas (So fat)
0
cs_biloute91 Messages postés 5 Date d'inscription mardi 11 décembre 2007 Statut Membre Dernière intervention 23 mai 2008
23 mai 2008 à 15:24
les combobox et textbox permettent de renseigner un critère pour la recherche.
Mon formulaire me permet de compter le nombre de valeur dans un tableau source qui correspond aux critères renseignés. Ex, Combient y-a-t-il de pomme verte mûre ou pomme rouge non mure ?
Toutefois, dans mon tableau de recensement j'ai un critère de date (non repris dans le code) et je souhaite savoir combien y-a-t-il de pomme verte mure entre le 18/05/2008 et 22/05/2008 ?
Dans mon USF,j'utilise un DTPicker pour info.

J'espère avoir été plus clair
0
bigfish_le vrai Messages postés 1835 Date d'inscription vendredi 13 mai 2005 Statut Membre Dernière intervention 20 novembre 2013 15
23 mai 2008 à 15:47
...

je ne sais pas pour les autres mais moi je ne vois toujours pas ou est le probleme !
Donne nous le bout de code qui te pose probleme, le/les messages d'erreur(s) ou tout autre info !

A+
0
Rejoignez-nous