View Full Version : Yes/No field in database won't work
BarrMan
07-09-2006, 04:01 PM
When i add to my code these lines it doesn't show me any results.
If AirCondition = True Then
SQL = SQL & " AND AirCondition=" & true
Else
SQL = SQL & " AND AirCondition=" & false
End If
Can anyone tell me what is the problem?
How should i write the condition?
Thanks.
mehere
07-09-2006, 04:05 PM
since you're saying yes/no field, i'm assuming it's an access database ... try this:
If AirCondition = True Then
SQL = SQL & " AND AirCondition=-1"
Else
SQL = SQL & " AND AirCondition=0"
End If
BarrMan
07-09-2006, 05:34 PM
It's not working either :/
mehere
07-09-2006, 07:01 PM
show the form field for aircondition. i've tested a query and it works.
BarrMan
07-09-2006, 09:54 PM
<TD width="46" align="middle" vAlign="bottom">מרפסת<BR>
<INPUT type="checkbox" value="1" name="balcony"></TD>
<TD width="32" align="middle" vAlign="bottom">חנייה<BR>
<INPUT type="checkbox" value="1" name="parkingSpot"></TD>
<TD width="38" align="middle" vAlign="bottom">מעלית<BR>
<INPUT type="checkbox" value="1" name="elevator"></TD>
<TD width="25" align="middle" vAlign="bottom">מזגן<BR>
<INPUT type="checkbox" value="1" name="aircondition"></TD>
mehere
07-09-2006, 10:39 PM
since your checkbox value is a 1 try this:
If AirCondition = 1 Then
SQL = SQL & " AND AirCondition=-1"
Else
SQL = SQL & " AND AirCondition=0"
End If
oracleguy
07-10-2006, 04:38 AM
You could also try putting the True/False in the quotes.
e.g.
If AirCondition = True Then
SQL = SQL & " AND AirCondition=true"
Else
SQL = SQL & " AND AirCondition=false"
End If
BarrMan
07-10-2006, 01:57 PM
It works now! Thanks! :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.