Results 1 to 4 of 4
  1. #1
    ProvPC is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    37

    Filtering a simple query via combobox

    Hi there!

    I have a form that contains a variety of query buttons based on simple "yes / no" fields. What I'm attempting to do is filter the results of the query by a combo box in such a way that, if no option is chosen all results are displayed, and if an option from the combo box is selected, the results are limited to those matching that criteria as well.

    For example, one button opens a query that indicates whether an air compressor is present. The query opens a datasheet that lists all entries in which an air compressor is present. I'd like to be able to limit the results to, say, air compressors located in a particular city.

    To get the air compressor results, I'm simply using the criteria "Yes" in the air compressor field. In an attempt to filter those results to a city, I'm using the following formula:

    IIf(IsNull([Forms]![frm_SearchResource]![cmbo_SRFilterCity],"*",[Forms]![frm_SearchResource]![cmbo_SRFilterCity]))


    which reads (to my untrained eye) like this: If SRFilterCity is null, then show all results. Otherwise, show the results indicated by the SRFilterCity combo box results.

    However, I get the following error when I try to save the query:
    "The expression you entered has a function containing the wrong number of arguments"
    So... what am I doing wrong? Any advice would be appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ProvPC is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    37
    Quote Originally Posted by pbaldy View Post
    That works perfectly! Thanks very much!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 12-09-2015, 11:11 AM
  2. Trouble filtering combobox
    By ittechguy in forum Forms
    Replies: 27
    Last Post: 09-08-2015, 08:08 PM
  3. Replies: 1
    Last Post: 05-24-2014, 09:08 AM
  4. Combobox Filtering in Form
    By dgwynn in forum Forms
    Replies: 6
    Last Post: 09-27-2012, 08:15 PM
  5. Replies: 1
    Last Post: 01-08-2012, 06:25 PM

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