Results 1 to 6 of 6
  1. #1
    Beppe is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    33

    multiple filter button

    Hello Access experts!
    I have a form where are listed all the records which have of course multiple fields. I have a number of buttons that do the filtration as per field, by writing what to search on a beside textbox.

    The code for each filter is the following:

    [/code]
    If IsNull(Me.Testo152) Then
    Me.FilterOn = False
    Else
    Me.Filter = "TIPO Like '" & Me.Testo152.Value & "*" & "'"
    Me.FilterOn = True
    End If
    [code]



    With this code I just filter only with one field.
    I would like to filter the records with the other filters, but taking into account the filtration of the other fields.

    For example, if I type in "TIPO" DCT and I have 3 records with this but different employee number, for example 11 and 2, I would like to do a further filtration by writing 11 on the employee field and have the DCT done by the employee 11.

    I think that I need to change something in the Me.filter instruction, maybe adding some AND or OR...

    Please help me I'm really stuck on this
    Beppe

  2. #2
    Beppe is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    33
    I tried this:

    [/code]
    If IsNull(Me.Testo152) Then
    Me.FilterOn = False
    Else
    Me.Filter = "TIPO Like '" & Me.Testo152.Value & "*" & "'" & "AND IMPIEGATO Like '" & Me.Testo139.Value & "'"
    Me.FilterOn = True
    End If
    [code]

    and seems that the button "type" functions, but only if both fields are not empty. Like this the "type" button does not works alone as before

  3. #3
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Me.Filter="TIPO Like '*" & Me!Testo152 & "*' AND IMPIEGATO Like '*" & Me!Testo139 & "*'"

    This requires that both fields are text data type and that both fields on the form contain values.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    beppe, your [CODE] idents are backwards

    code :1st
    /code :last

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Also see the search example code at Allen Browne's site

    The search criteria article is here

  6. #6
    Beppe is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    33
    Hello!
    I solved the issue like this:

    Code:
    If IsNull(Me.Testo152) Then
            Me.FilterOn = False
        Else
            Me.Filter = "TIPO Like '" & Me.Testo152.Value & "*" & "'" & _
            "AND PORTATA Like '" & Me.Testo161.Value & "*" & "'" & _
            "AND COD_FORNITORE Like '" & Me.Fornitore.Value & "*" & "'" & _
            "AND COD_CLIENTE Like '" & Me.Cliente.Value & "*" & "'" & _
            "AND DATA Like '" & Me.Testo155.Value & "*" & "'" & _
            "AND COMMESSA Like '" & Me.Testo158.Value & "*" & "'"
            Me.FilterOn = True
        End If
    Thank you everyone!

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

Similar Threads

  1. Replies: 2
    Last Post: 02-20-2017, 11:28 PM
  2. filter command button
    By FRAZ in forum Access
    Replies: 3
    Last Post: 01-14-2014, 10:30 PM
  3. Replies: 3
    Last Post: 11-27-2012, 07:20 AM
  4. Replies: 28
    Last Post: 03-08-2012, 06:47 PM
  5. Filter button
    By tomeem in forum Access
    Replies: 0
    Last Post: 08-28-2009, 12:50 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