Results 1 to 2 of 2

Checkbox to influence Query results

  1. #1
    FriQenstein is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    54

    Checkbox to influence Query results


    Greetings all,

    I am trying to add some checkbox functionality to one of my forms for a query result.
    On the form, the user can utilize one of the input fields to type in search criteria, then click the search button and it will open the report with the appropriate queried information... as per normal.

    What I want to do is add check boxes that would allow the user to not only search based on the text they type in, but also use the criteria from the check box.

    For example: A user wishes to search for equipment based on the description but also wants to include only the refurbished units in this list. (see attached screenshot)
    How would I go about getting this linked up correctly? I am assuming I would need to write some VBA for when the checkbox is activated/deactivated, which I can do, but I am not certain how to get that linked to the query criteria being searched for. Would all of this be included in the VBA script/macro or would it be in the query criteria field?

    Regards.
    Attached Thumbnails Attached Thumbnails Query with checkbox option.png  

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,375
    I would build a where condition:

    http://www.baldyweb.com/wherecondition.htm

    I'd add each field as appropriate to whether it was checked or not, like:

    Code:
    If (Me.chkNew) Then
      strWhere = strWhere &  "New = True AND "
    End If
    at the end you'd see if the variable had been populated and if so trim off the trailing "AND".
    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: 6
    Last Post: 08-21-2019, 07:17 AM
  2. Locking the results of a checkbox
    By jsmm91 in forum Forms
    Replies: 7
    Last Post: 07-27-2017, 07:52 AM
  3. Replies: 1
    Last Post: 11-26-2014, 02:30 PM
  4. Replies: 6
    Last Post: 05-14-2012, 07:24 AM
  5. Use a lookup field to influence values in another field
    By nathanrt in forum Database Design
    Replies: 3
    Last Post: 01-13-2011, 03:40 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
  •  
Tech Forums: Microsoft Office Forums