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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using value of check box on form as parm in query

Status
Not open for further replies.

KimmieB

Programmer
Apr 1, 2005
20
US
I need to create a query that selects data based on whether a check box on a form is selected or not. Any help is appreciated.
 
Does the check box refer to a boolean field in the table? Do you have a query that works except for the check box criteria? Could you post the query?

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
The check box refers to a certain status of records not a boolean value. The label on the check box is "Include Closed Y/N" so if it's not checked then my query needs to have a where clause to select records where the status field is anything but a "closed" status. I know I can fudge it and make it into 2 different queries that I can call from the form based on the value of the check box but that seems kinda hokey.
 
Dynamic SQL... build an event on your "Submit" button.

It involves:
First, set a string variable strSQL equal to the correct SQL.
Then, CurrentDb.QueryDefs("QueryName").SQL = strSQL

If you can't get it, paste your SQL code and I can show you specifically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top