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

SQL Statement w/ Boolean value

Status
Not open for further replies.

Sam63

Technical User
Nov 19, 2001
18
US
I'm familiar with writing SQL statements in code but the one that I'm working on currently is giving me a headache.

I'm trying to narrow my records set to records that match three criteria. One is a numeric field the other two are boolean fields. Right now the query is only returning the records that match the number field even though I have set the WHERE criteria to search for the other two values. the statement is below. Please advise. Thanks.

strSQL = "SELECT Call.CallID FROM Call WHERE (((Call.AgentID) = " & id & _
") AND ((Call.FormsNeedSent) = True) AND ((Call.FormsSent) = False)"
 
Hi!

Take away all of your parentheses and try it.

hth Jeff Bridgham
bridgham@purdue.edu
 
I usually have better luck with this stuff if I use the numeric equivalents: -1 for true (checked if a check box) or <>-1 for not checked (which can be 0 or null, hence the <>-1, which catches both).

also, noticed that you're concatenating a variable into the string for ID, but not for the two booleans...is that on purpose?

HTH
Ben
 
yes, The string is the users id which varies. the two boolean values should remain constant.

Thanks I'lll try your suggestions.

Sam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top