Search Continuous Form with one textbox (1 Viewer)

basilyos

Registered User.
Local time
Yesterday, 19:33
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
Today, 10:33
Joined
May 7, 2009
Messages
16,812
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
Yesterday, 19:33
Joined
Jan 13, 2014
Messages
252
works perfect. thanks
 

Users who are viewing this thread

Top Bottom