elisatya
Nouveau membre
Bonjour,
j'ai 6 critères de recherche sur un formulaire que l'on active via une checkbox dt voici le code :
Private Sub chktype_Click()
If Me.chktype Then
Me.cmbtype.Visible = False
Else
Me.cmbtype.Visible = True
End If
refreshquery
End Sub
Et voici le code de ma liste de resultats :
Private Sub refreshquery()
Dim sql As String
Dim sqlwhere As String
sql = "select nomtypeproduit from types produit, nomdistributeur from distributeurs, nomfabricant from fabricants, normeproduit from produits, PNproduit from produits, nomassembleur from assembleurs"
If Me.chktype Then
sql = sql & "and types produit!nomtypeproduit = '" & Me.cmbtype & "' "
End If
If Me.chkdistributeur Then
sql = sql & "and distributeurs!nomdistributeur = '" & Me.cmbdistributeur & "' "
End If
If Me.chkfournisseur Then
sql = sql & "and fournisseurs!nomfournisseur = '" & Me.cmbfournisseur & "' "
End If
If Me.chkassembleur Then
sql = sql & "and assembleurs!nomassembleur = '" & Me.cmbassembleur & "' "
End If
If Me.chkpn Then
sql = sql & "and produits!PNproduit like '*" & Me.txtpn & "*' "
End If
If Me.chknorme Then
sql = sql & "and produits!normeproduit like '*" & Me.txtnorme & "*' "
End If
sqlwhere = Trim(Right(sql, Len(sql) - InStr(sql, "where") - Len("where") + 1))
sql = sql & ";"
melistresultat.RowSource = sql
Me.listresultat.Requery
End Sub
Au moment ou je clique sur une chekbox le message erreur de compilation apparait.
Pouvez vous m'aider ?!
Merci
Elisa
j'ai 6 critères de recherche sur un formulaire que l'on active via une checkbox dt voici le code :
Private Sub chktype_Click()
If Me.chktype Then
Me.cmbtype.Visible = False
Else
Me.cmbtype.Visible = True
End If
refreshquery
End Sub
Et voici le code de ma liste de resultats :
Private Sub refreshquery()
Dim sql As String
Dim sqlwhere As String
sql = "select nomtypeproduit from types produit, nomdistributeur from distributeurs, nomfabricant from fabricants, normeproduit from produits, PNproduit from produits, nomassembleur from assembleurs"
If Me.chktype Then
sql = sql & "and types produit!nomtypeproduit = '" & Me.cmbtype & "' "
End If
If Me.chkdistributeur Then
sql = sql & "and distributeurs!nomdistributeur = '" & Me.cmbdistributeur & "' "
End If
If Me.chkfournisseur Then
sql = sql & "and fournisseurs!nomfournisseur = '" & Me.cmbfournisseur & "' "
End If
If Me.chkassembleur Then
sql = sql & "and assembleurs!nomassembleur = '" & Me.cmbassembleur & "' "
End If
If Me.chkpn Then
sql = sql & "and produits!PNproduit like '*" & Me.txtpn & "*' "
End If
If Me.chknorme Then
sql = sql & "and produits!normeproduit like '*" & Me.txtnorme & "*' "
End If
sqlwhere = Trim(Right(sql, Len(sql) - InStr(sql, "where") - Len("where") + 1))
sql = sql & ";"
melistresultat.RowSource = sql
Me.listresultat.Requery
End Sub
Au moment ou je clique sur une chekbox le message erreur de compilation apparait.
Pouvez vous m'aider ?!
Merci
Elisa