Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access Queries - Passing a Yes/No value from a form to a query

Status
Not open for further replies.

belangerg

Programmer
Nov 7, 2008
7
CA
I have a query with a yes/no field in it. I want to create a form for the user so they can either select all the records with the field checked ("yes") or All the records (both "yes" and "no"). They would then press a button to run the query. The query would then pick up its criteria from the form. I am having trouble with passing the Yes value and how do I query for both(no criteria)?
 
Yes/No and check boxes are -1 for checked/yes/true and 0 for unchecked/no/false. I would expect your yes/no fields to store -1 or 0. If the criteria check box is checked, it should have a value of -1 and unchecked is 0.

Can you share the SQL view of your query? Are you sure the field in your table is truly 0 and not null?

Duane
Hook'D on Access
MS Access MVP
 
Yes, I know that. So how would the user select all records (as a check box returns a value of 0 OR -1 not both). How does the user select NULL for the check box?
 
No SQL view :-(

If the criteria check box is checked, the value should be -1. If you set up the criteria as I suggested it should resolve to:
[tt][blue]>= -1[/blue][/tt]
This should match every record that is storing either -1 or 0.



Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top