Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Query Based on Check Box
Bryan Gravely 
    
4 years ago
I have a form that lets me search a table based on multiple criteria.  One of these criteria is whether a Yes/No Favorite field in the table is set to Yes.  On the search form, I have a checkbox for Show Favorites.  If this box is checked, the query should only return records where Favorites is Yes.  But if it's unchecked it should return all records.
Since you can't use an iff function in the criteria field, I haven't been able to find a way to do this.  Setting the criteria to Like "*" & [Forms]![FormName]![CheckboxName] & "*" gets me half way there.  If the box is checked it shows only records where favorite is yes.  But unfortunately, when it's not checked it only shows records where favorite is No, instead of all records.
Bryan Gravely OP  @Reply  
    
4 years ago

Bryan Gravely OP  @Reply  
    
4 years ago

Bryan Gravely OP  @Reply  
    
4 years ago

Bryan Gravely OP  @Reply  
    
4 years ago
As you can see in the pictures above, when Favorites is checked it shows only Favorites.  But when it's unchecked it's showing only records where Favorites isn't set instead of All records
Kevin Robertson  @Reply  
          
4 years ago
Try this as your Query criteria:
Like IIf([Forms]![F_MovieSuperSearch]![chk_FavMovie],True,"*")
Bryan Gravely OP  @Reply  
    
4 years ago
@Kevin, that did it.  Thank you so much!
Kevin Robertson  @Reply  
          
4 years ago
You're welcome.
Scott Axton  @Reply  
        
4 years ago

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 10:46:44 AM. PLT: 1s