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

Pass Yes/No (checkbox) value to SQL statement 1

Status
Not open for further replies.

colossalUW

Technical User
Jan 28, 2005
16
US
Hey gang,

This one is driving me nuts and I'm having no luck searching the forums.

I have a basic search form containing combo boxes and check boxes. The user selects criteria from these, clicks the Search button, and the query results appear in a list box.

Passing variables for the combo box values to the SQL statement works great, but not for the check boxes. I've checked the SQL statement, and the WHERE statement seems to be fine, i.e. if the box is checked, then the WHERE includes [tblGrants].[Federal]='-1'. However, the list box displays no results.

I'm using this to set my string value from the check box chkFed: strFed = "='" & Me.chkFed.Value & "'"

I've also tried setting the value of the checkbox to a boolean variable, and then: strFed = "='" & blnFed & "'"
but that isn't working either.

Am I missing something obvious?

Thanks much!
Rob
 
A boolean is a numeric field so no need of single quotes ...
WHERE should includes [tblGrants].[Federal]=-1.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ah, yes, I'm slapping my forehead now.

Thanks for the tip, PH!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top