Bon je viens donc de regarder. Et j'ai le même résultat.
Voici le code recherche qui vient du tuto. Il n'y a que les variables tables et champs qui peuvent avoir une incidence.
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
| Private Sub cmd_recherche_Click()
Dim strTable As String, strField As String, strCriteria As String, strSql As String
Dim Criter As Variant
'strTable = "[" & Me.cbo_table & "]" ' recupère le nom de la table
'strField = "[" & Me.cbo_champ & "]" ' recupère le nom du champ
strTable = Me.cbo_table ' recupère le nom de la table
strField = Me.cbo_champ ' recupère le nom du champ
' compose le critere de recherche
Select Case Me.opt_Recherche
Case 1 ' strictement egal
strCriteria = strTable & "." & strField & " Like """ & Me.txt_critere & """"
Case 2 ' commence par
strCriteria = strTable & "." & strField & " Like """ & Me.txt_critere & "*"""
Case 3 ' contient
strCriteria = strTable & "." & strField & " Like ""*" & Me.txt_critere & "*"""
Case 4 ' fini par
strCriteria = strTable & "." & strField & " Like ""*" & Me.txt_critere & """"
Case 5 ' ne contient pas
strCriteria = "NOT (" & strTable & "." & strField & " Like ""*" & Me.txt_critere & "*"")"
End Select
' construit la requête sql
strSql = "SELECT DISTINCTROW " & strTable & ".*"
strSql = strSql & " FROM " & strTable
strSql = strSql & " WHERE ((" & strCriteria & "));"
Me.lst_resultat.RowSource = strSql ' affecte sql a lst_Resultat
Me.lst_resultat.Requery ' recalcule la liste
End Sub |
Le debug.rpint :
SELECT DISTINCTROW Archives_Accueillis_Simples.* FROM Archives_Accueillis_Simples WHERE ((Archives_Accueillis_Simples.Nom Like "cav*"));
ou
SELECT DISTINCTROW [Archives_Accueillis_Simples].* FROM [Archives_Accueillis_Simples] WHERE (([Archives_Accueillis_Simples].[Nom] Like "ca*"));
Partager