Probleme de filtre combobox & bd

cs_ANOUCHKA8686 Messages postés 29 Date d'inscription jeudi 10 avril 2008 Statut Membre Dernière intervention 25 mai 2008 - 13 mai 2008 à 23:39
cs_ANOUCHKA8686 Messages postés 29 Date d'inscription jeudi 10 avril 2008 Statut Membre Dernière intervention 25 mai 2008 - 14 mai 2008 à 19:26
bonjour  

Set Ct = New ADODB.Connection
    Ct.Provider = "Microsoft.Jet.Oledb.4.0"
    Ct.ConnectionString = App.Path & "\ZI.mdb"
    Ct.Open
     '___________________________________DELEGATION
    tmp = Combo4
    Select Case tmp
    Case "ARIANA"
    sql = "select NOM_DELEG from DELEGATION where CODE_GOUV=12"
    Case "TUNIS"
    sql = "select NOM_DELEG from DELEGATION where CODE_GOUV=11"
    Case "BEN AROUS"
    sql = "select NOM_DELEG from DELEGATION where CODE_GOUV=13"
    Case "MANOUBA"
    sql = "select NOM_DELEG from DELEGATION where CODE_GOUV=14"
    End Select
   
    Set RcCombo = New ADODB.Recordset
    RcCombo.Open sql, Ct, adOpenDynamic
    Combo2.Clear
   
    Do Until RcCombo.EOF
        Combo2.AddItem RcCombo!NOM_DELEG
        RcCombo.MoveNext
    Loop
    RcCombo.Close
    '___________________________________GOUVERNORAT
    Set RcCombo = New ADODB.Recordset
    RcCombo.Open "SELECT NOM_GOUV FROM GOUVERNORAT ORDER BY NOM_GOUV", Ct, adOpenDynamic
    Combo4.Clear
   
    Do Until RcCombo.EOF
        Combo4.AddItem RcCombo!NOM_GOUV
        RcCombo.MoveNext
    Loop
    RcCombo.Close
   

voile mon code , bon avan de metre la boucle case tt marche comme sur des roulettes
mais comme j avai besoin de filtre le contenu de mon conmbo j ai mit cette boucle
mais il me sort toujour le message ' les arguments sont de type incorecte'

3 réponses

Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 74
14 mai 2008 à 06:28
CODE_GOUV n'est peut etre pas numérique, auquel cas, les valeurs qui s'y rapportent doivent etre encadrées par des quotes '
0
cs_ANOUCHKA8686 Messages postés 29 Date d'inscription jeudi 10 avril 2008 Statut Membre Dernière intervention 25 mai 2008
14 mai 2008 à 13:07
CODE_GOUV  est un entier
0
cs_ANOUCHKA8686 Messages postés 29 Date d'inscription jeudi 10 avril 2008 Statut Membre Dernière intervention 25 mai 2008
14 mai 2008 à 19:26
bonjour voila j ai un probleme avec le filtre saarche pas  , je ne sais pas se qui cloche???

Private Sub Combo2_click()
If Trim$(Combo2.Text) = "" Then Exit Sub
   
    Set RcCombo = New ADODB.Recordset
    Set Rc = New ADODB.Recordset
    Set newRs = RsEncours.Clone
    Rc.Open "DELEGATION", Ct, adOpenDynamic, adLockOptimistic
    Rc.Find "NOM_DELEG=" & "'" & Combo2.Text & "'"    newRs.Filter ("nom_gouv'" & Combo4 & "'")
      
    Dim recs As MapObjects2.Recordset
    Dim shp As Object
    Dim rect As MapObjects2.Rectangle
    Dim exp As String    exp "NOM_DELEG '" & Combo2.Text & "'"
    Set recs = Map1.Layers("DELEG"). _
    SearchExpression(exp)
End Sub
0
Rejoignez-nous