1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Private Sub txt_Search_Change()
'CODE THAT HANDLES WHAT HAPPENS WHEN THE USER TYPES IN THE SEARCH BOX
Dim strFullList As String
Dim strFilteredList As String
10 If blnSpace = False Then
20 Me.Refresh 'refresh to make sure the text box changes are actually available to use
'specify the default/full rowsource for the control
30 strFullList = "SELECT [tbl_Livres].ID_Donnee, tbl_Categories.Categorie, tbl_Collections.Collection, [tbl_Livres].Theme, [tbl_Livres].Titre, [tbl_Livres].MotsCles, tbl_Auteurs.Nom, tbl_Auteurs.Premons, [tbl_Livres].DatePublication, tbl_Regions.Region, [tbl_Livres].Ville, [tbl_Livres].Langue, [tbl_Livres].Statut FROM tbl_Regions INNER JOIN (tbl_Emplacements INNER JOIN (tbl_Collections INNER JOIN (tbl_Categories INNER JOIN (tbl_Auteurs INNER JOIN [tbl_Livres] ON tbl_Auteurs.ID_Auteur = [tbl_Livres].Auteur) ON tbl_Categories.ID_Categorie = [tbl_Livres].Categorie) ON tbl_Collections.ID_Collection = [tbl_Livres].Collection) ON tbl_Emplacements.ID_Emplacement = [tbl_Livres].Emplacement) ON tbl_Regions.ID_Region = [tbl_Livres].Region ORDER BY [tbl_Livres].ID_Donnee;"
'specify the way you want the rowsource to be filtered based on the user's entry
40 strFilteredList = "SELECT [tbl_Livres].ID_Donnee, tbl_Categories.Categorie, tbl_Collections.Collection, [tbl_Livres].Theme, [tbl_Livres].Titre, [tbl_Livres].MotsCles, tbl_Auteurs.Nom, tbl_Auteurs.Premons, [tbl_Livres].DatePublication, tbl_Regions.Region, [tbl_Livres].Ville, [tbl_Livres].Langue, [tbl_Livres].Statut FROM tbl_Regions INNER JOIN (tbl_Emplacements INNER JOIN (tbl_Collections INNER JOIN (tbl_Categories INNER JOIN (tbl_Auteurs INNER JOIN [tbl_Livres] ON tbl_Auteurs.ID_Auteur = [tbl_Livres].Auteur) ON tbl_Categories.ID_Categorie = [tbl_Livres].Categorie) ON tbl_Collections.ID_Collection = [tbl_Livres].Collection) ON tbl_Emplacements.ID_Emplacement = [tbl_Livres].Emplacement) ON tbl_Regions.ID_Region = [tbl_Livres].Region "
50 strFilteredList = strFilteredList & "WHERE [ID_Donnee] LIKE ""*" & Me.txt_Search.Value & "*"" OR [Categorie] LIKE ""*" & Me.txt_Search.Value & "*"" OR [Collection] LIKE ""*" & Me.txt_Search.Value & "*"" OR [Theme] LIKE ""*" & Me.txt_Search.Value & "*"" OR [Titre] LIKE ""*" & Me.txt_Search.Value & "*"" OR [MotsCles] LIKE ""*" & Me.txt_Search.Value & "*"" OR [Nom] LIKE ""*" & Me.txt_Search.Value & "*"" OR [Premons] LIKE ""*" & Me.txt_Search.Value & "*"" OR [DatePublication] LIKE ""*" & Me.txt_Search.Value & "*"" OR [Region] LIKE ""*" & Me.txt_Search.Value & "*"" OR [Ville] LIKE ""*" & Me.txt_Search.Value & "*"" OR [Langue] LIKE ""*" & Me.txt_Search.Value & "*"" ORDER BY [ID_Donnee];"
'run the search
60 fLiveSearch Me.txt_Search, Me.lst_SearchResults, strFullList, strFilteredList, Me.txtCount
70 End If |
Partager