help to Filtering Listbox

zozzz,
you may want to upload your example directly to the this site rather than post a link to an outside host. Many people are reluctant to download from an unknown source.
 
try, you can also filter by Lastname.
 

Attachments

zozzz,
you may want to upload your example directly to the this site rather than post a link to an outside host. Many people are reluctant to download from an unknown source.
Thank you very much for this remark
It's awfully kind of you

Please using defined module
 

Attachments

it appears your function returns a where clause so something like
Code:
Dim strWhere As String
Dim strSql As String
strWhere = Search("[Fname] & [Contry] & [Age] & [Phon]", "Table1", Nz(Me.Text4.Text))
strSql = "SELECT [Table1].[ID], [Table1].[Fname], [Table1].[Contry], [Table1].[Age], [Table1].[Phon] FROM Table1  where " & strWhere & " ORDER BY [ID];"

Me.List23.RowSource = strSql
should work to populate your listbox

I tested it as below..
Code:
Private Sub Text4_Change()
    On Error Resume Next
    Me.Form_sub.Form.Filter = Search("[Fname] & [Contry] & [Age] & [Phon]", "Table1", Nz(Me.Text4.Text))
    Me.Form_sub.Form.FilterOn = True
    Me.Form_sub.Form.Requery

    LBox

    If Me.Text4.Text = "" Then
        Me.Form_sub.Form.FilterOn = False
        Me.Form_sub.Form.Requery
    End If
End Sub

Private Sub LBox()
    Dim strWhere As String
    Dim strSql As String
    strWhere = Search("[Fname] & [Contry] & [Age] & [Phon]", "Table1", Nz(Me.Text4.Text))
    strSql = "SELECT [Table1].[ID], [Table1].[Fname], [Table1].[Contry], [Table1].[Age], [Table1].[Phon] FROM Table1  where " & strWhere & " ORDER BY [ID];"

    Me.List23.RowSource = strSql


End Sub
 
moke123 ,

I am very much obliged to you . Your formula was very high
But you just defined for one Text box and search in all Fields
I wanted to be defined for each Textbox and search in one Field

a66d6458.jpg
 

Users who are viewing this thread

Back
Top Bottom