Results 1 to 5 of 5
  1. #1
    okan is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2017
    Location
    Switzerland
    Posts
    4

    Question Using ApplyFilter with multiple columns for search

    Hello Accessforum



    I' have made a "split-form", and i have there a "listbox" with few entrys. With a button I should start searching the for selcted entry in my database.
    I used the Macro "ApplyFilter" here to, like on the other buttons in my Form.
    But the difference to the other buttons is, this new button should search in multiple columns. But I have no Idea how to write the correct condition.


    Summary:
    My problem is, can I specify more than one column for searching the entry in the Listbox with "ApplyFilter"?

    My code that always worked with one column:

    [Hauptverantwortlicher] Like "*" & [Forms]![MasterQuery]!
    [ListVerantwortlichkeit] & "*"

    I have tried to specify more than one column with the "or". But it doesn't work.:
    [Hauptverantwortlicher] Or [Stellvertretung] Like "*" & [Forms]![MasterQuery]!
    [ListVerantwortlichkeit] & "*"


    Can someone help me?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,973
    Are they both text type field?

    Use AND operator along with the same LIKE criteria under each field.

    Use the Access query builder to test.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    okan is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2017
    Location
    Switzerland
    Posts
    4
    Hello June7

    I'm not sure that I have understand you correctly.
    I want to build an "or" expression, not an "and".

    Or do you mean maybe I should add few new action's for each column?

    can you please make an example?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,973
    Then try OR operator with the same criteria under each field and see if you get what you want.

    [Hauptverantwortlicher] Like "*" & [Forms]![MasterQuery]!
    [ListVerantwortlichkeit] & "*" Or [Stellvertretung] Like "*" & [Forms]![MasterQuery]!
    [ListVerantwortlichkeit] & "*"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    okan is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2017
    Location
    Switzerland
    Posts
    4
    Oh thank you very mutch....
    You're a genious!!!

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

Similar Threads

  1. Multiple entries for ApplyFilter?
    By kwelch in forum Macros
    Replies: 4
    Last Post: 11-25-2016, 06:08 AM
  2. DoCmd.applyfilter for multiple
    By vicsaccess in forum Programming
    Replies: 4
    Last Post: 11-10-2015, 05:02 PM
  3. Replies: 2
    Last Post: 05-15-2014, 06:15 AM
  4. Combo Box Search from Multiple Columns
    By tdoolittle in forum Forms
    Replies: 1
    Last Post: 04-10-2014, 07:54 PM
  5. Replies: 2
    Last Post: 04-17-2013, 02:12 PM

Tags for this Thread

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