Search Continuous Form with one textbox (1 Viewer)

basilyos

Registered User.
Local time
Today, 13:09
Joined
Jan 13, 2014
Messages
252
hello, i have a continuous form for now i can search just one field with this code

Code:
Dim strFilter As String

    If Len(Trim(Me.txt_Search.Value & vbNullString)) > 0 Then
        strFilter = "Clientname Like '*" & Replace(Me.txt_Search.Value, "'", "''") & "*'"
        Me.Filter = strFilter
        Me.FilterOn = True
        Me.txt_Search.SetFocus
        Me.txt_Search.Value = ""
    Else
        Me.FilterOn = False
        Me.txt_Search.SetFocus
        Me.txt_Search.Value = ""
    End If

is there anyway to search 4 fields at the time from txt_Search
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:09
Joined
May 7, 2009
Messages
19,230
Code:
    If Len(Trim(Me.txt_Search.Value & vbNullString)) > 0 Then
        strFilter = "Clientname Like '*" & Replace(Me.txt_Search.Value, "'", "''") & "*' Or " & _
        "AnotherField Like '*" & Replace(Me.txt_Search.Value, "'", "''") & "*' Or " & _
        "AnotherField2 Like '*" & Replace(Me.txt_Search.Value, "'", "''") & "*' Or " & _
        "AnotherField3 Like '*" & Replace(Me.txt_Search.Value, "'", "''") & "*'"
 

basilyos

Registered User.
Local time
Today, 13:09
Joined
Jan 13, 2014
Messages
252
works perfect. thanks
 

Users who are viewing this thread

Top Bottom