Bonjour,
j'ai créer un formulaire de recherche multi critès sur base de l'exemple de cafeine.
J'utilise actuellement 6 listes de choix pour faire ma sélection.
Lors de la sélection via rédacteur, rien ne s'affiche dans ma zone de liste "lstresult".
code zone de liste
1 2 3
| Private Sub cmbRedacteur_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| Private Sub RefreshQuery()
Dim SQL As String
Dim SQLWhere As String
SQL = "SELECT R_Information.[ref information], R_Information.titre, R_Information.nom, R_Information.Type, R_Information.phrases FROM R_Information WHERE [R_Information]![ref titre]<>0 "
If Not Me.chkRedacteur Then
If Not IsNull(Me.cmbredacteur) Then
SQL = SQL & " And R_information![ref redacteurs] like " & Me.cmbredacteur
End If
End If
If Not Me.chkTitres Then
If Not IsNull(Me.cmbTitres) Then
SQL = SQL & "And R_information![ref titre] like " & Me.cmbTitres
End If
End If
If Not Me.chkMotsClef Then
If Not IsNull(Me.cmbMotsClef) Then
SQL = SQL & "And R_information![ref mots clef] = " & Me.cmbMotsClef
End If
End If
If Not Me.chkType Then
If Not IsNull(Me.cmbType) Then
SQL = SQL & "And R_information![ref type] = " & Me.cmbType
End If
End If
If Not Me.chkSousTitre Then
If Not IsNull(Me.cmbSousTitre) Then
SQL = SQL & "And R_information![ref sous titre] = " & Me.cmbSousTitre
End If
End If
If Not Me.ChkPhrasesTypes Then
If Not IsNull(Me.CmbPhrasesTypes) Then
SQL = SQL & " And R_information!phrasesTypes = " & Me.CmbPhrasesTypes
End If
End If
SQLWhere = Trim(Right(SQL, Len(SQL) - InStr(SQL, "Where ") - Len("Where ") + 1))
SQL = SQL & ";"
Debug.Print SQL
' compteur d'enregistrements'
Me.lblStats.Caption = DCount("*", "R_Information", SQLWhere) & " / " & DCount("*", "R_Information")
Me.lstResults.RowSource = SQL
Me.lstResults.Requery
End Sub |
Dans la ligne de code suivante, Je fais référence à la R_Information.nom.
SQL = "SELECT R_Information.[ref information], R_Information.titre, R_Information.nom, R_Information.Type, R_Information.phrases FROM R_Information WHERE [R_Information]![ref titre]<>0 "
Ceci à pour but d'afficher le nom du rédacteur plus tot que sa référence.
Est ce que le problème viens du fait que je veux afficher le nom etpas la référence?
Merçi
Tomas
Partager