Results 1 to 2 of 2
  1. #1
    johnnyvino is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Dec 2016
    Posts
    1

    Multi-parameter query

    I have a query to a table with several Yes/No fields.



    I would like to create a form where I have the option to enter Yes for any (or multiple) of those fields, and then run the query to get data sheet result.

    Is there an easy way to do this that I'm completely missing?

    Thanks!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    no , not easy. If you want it easy the USER , then you must write code to analyse the check boxes marked.

    You cant use form boxes in a query if there's nothing in them..so..
    Test all controls for a possible filter then build the where clause.
    the form is a continous form of records of all until the filter applies.
    then the Find button would run this
    Code:
    sub btnFind_click()
    if not isnull(cboState) then   sWhere = sWhere & " and [state]='" & cboState & "'"
    if not IsNull(txtName) then    sWhere = sWhere & " and [Name]='" & txtName & "'"
    if not IsNull(chkContact) then sWhere = sWhere & " and [Contact]=" & chkContact.value
    
        'remove 1st And
    sWhere= mid(sWhere,4)
    
      'just use the filter
    
    me.filter = sWhere
    me.filterOn = true
    end sub

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

Similar Threads

  1. Replies: 1
    Last Post: 10-08-2015, 10:59 AM
  2. Multi Select Listbox parameter for Query
    By KBAR12 in forum Programming
    Replies: 70
    Last Post: 03-26-2014, 11:22 AM
  3. Replies: 6
    Last Post: 11-02-2012, 12:48 PM
  4. Replies: 3
    Last Post: 12-08-2011, 10:52 AM
  5. Replies: 11
    Last Post: 09-22-2011, 01:13 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