silentwolf
Active member
- Local time
- Today, 07:06
- Joined
- Jun 12, 2009
- Messages
- 572
Hi guys,
I am trying to filter a continious subform with a textbox and search button.
Following situation:
Query qryKontakteSortiert
As you can see the Contacts are listed either in the Company (Firma) or if they are private People then with FirstName(Kont_Vorname) and Lastname(Kont_Nachname)
The RowSource of the combobox on the subform is "qryKontakteSortiert"
Because it is hard to know how those Contacts are starting with I am trying to find a way to filter with a textbox and a button the combobox.
Now that works kind of as all comboboxes getting the RowSource and that is of course not really that great.
I could have a routine to clear the strSQ and fill it again but I am not sure it that is even a good way of doing it.. I mean the whole "filter"
Maybe someone can let me know how you would tackle this situation?
As I need or like to implement the same kind of filter for an Item Subform it would be great to have a good way of doing this.
Hope this is understandable what I am trying to do and would be appreciated if someone has a tip for me.
Many thanks
Albert
I am trying to filter a continious subform with a textbox and search button.
Following situation:
Query qryKontakteSortiert
Code:
SELECT tbl_Kontakte.Kont_ID, IIf([Kont_Firma]<>"",[Kont_Firma],[Kont_Vorname] & " " & [Kont_Nachname]) AS KundeName
FROM tbl_Kontakte
ORDER BY IIf([Kont_Firma]<>"",[Kont_Firma],[Kont_Vorname] & " " & [Kont_Nachname]);
As you can see the Contacts are listed either in the Company (Firma) or if they are private People then with FirstName(Kont_Vorname) and Lastname(Kont_Nachname)
The RowSource of the combobox on the subform is "qryKontakteSortiert"
Because it is hard to know how those Contacts are starting with I am trying to find a way to filter with a textbox and a button the combobox.
Code:
Private Sub btnSearch_Click()
Dim strSQL
strSQL = "SELECT * FROM qryKontakteSortiert WHERE [KundeName] LIKE '*" & Me!txtSearch.Value & "*'"
Me!cboContacts.RowSource = strSQL
End Sub
Now that works kind of as all comboboxes getting the RowSource and that is of course not really that great.
I could have a routine to clear the strSQ and fill it again but I am not sure it that is even a good way of doing it.. I mean the whole "filter"
Maybe someone can let me know how you would tackle this situation?
As I need or like to implement the same kind of filter for an Item Subform it would be great to have a good way of doing this.
Hope this is understandable what I am trying to do and would be appreciated if someone has a tip for me.
Many thanks
Albert