Results 1 to 2 of 2
  1. #1
    Shamli is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2018
    Location
    California
    Posts
    142

    Filter List Box Using text boxes

    Hello Everyone,


    I am trying to filter the list box using text boxes.
    I was able to accomplish filtering the listbox using one text box.
    I wanted to filter it with two more text boxes.

    Text Box After update Event:
    Code:
    Private Sub txtSearch_AfterUpdate()
    DoCmd.ApplyFilter "", "[Employee_T].FullName like '*" & [txtSearch] & "*' "
    DoCmd.Requery
    [Forms]![TaskOrder]![lstEmployee].Requery
    End Sub
    And in the list box I Used,
    Code:
    Is Not Null And Like "*" & IIf([forms]![TaskOrder]![txtSearch]<>"",[forms]![taskOrder]![txtSearch],"") & "*"
    This is working!
    I have following fields in the list box :
    EmployeeID, FullName, TO Start Date, TO End Date, Active


    The above code helps in filtering the FullName.
    Now I wanted to filter the TO STARt Date, Enddate and active.


    can anyone help me with this.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Code:
    sub txtBox_Afterupdate()
    If IsNull(txtBox) Then
       lstBox.rowsource = "qsAllRecs"
    Else
       lstBox.rowsource = "qsFilterRecs"
    End If
    end sub

    the query: qsFilterRecs
    which would use the text box:
    select * from table where [Lastname] like "*" & forms!myForm!txtBox & "*"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Multiple filter with unbound text boxes
    By cbende2 in forum Access
    Replies: 2
    Last Post: 05-21-2015, 08:47 AM
  2. Replies: 15
    Last Post: 11-20-2013, 04:30 PM
  3. Filter subform based on text boxes
    By lewis1682 in forum Programming
    Replies: 7
    Last Post: 08-21-2013, 11:09 AM
  4. Replies: 8
    Last Post: 08-09-2011, 09:04 AM
  5. Replies: 1
    Last Post: 03-01-2009, 09:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums