-
Checkbox values
I have a table that consists of 5 fileds and three of those fields are yes/no boxes, and I have an asp page with three checkboxes on it. If I create an SQL statement "SELECT * FROM myTable" and the only record in the record set returns two true values and one false value for the three yes/no boxes in the access database. How would I assign the values to the checkboxes on my asp page?
The following does not work:
Code:
<input type="checkbox" name="AC" Value= <%=rs.fields("AC").value%> >
Can someone give me an example of the correct syntax?
-
Re: Checkbox values
Quote:
Originally posted by MichaelC2468
I have a table that consists of 5 fileds and three of those fields are yes/no boxes, and I have an asp page with three checkboxes on it. If I create an SQL statement "SELECT * FROM myTable" and the only record in the record set returns two true values and one false value for the three yes/no boxes in the access database. How would I assign the values to the checkboxes on my asp page?
The following does not work:
Code:
<input type="checkbox" name="AC" Value= <%=rs.fields("AC").value%> >
Can someone give me an example of the correct syntax?
Code:
<%
dim IsChecked
if rs("AC") then
IsChecked="checked"
else
IsChecked=""
end if
%>
<input type="checkbox" name="AC" <%=IsChecked%>>
-
Or modify your SQL statement
SELECT IIF(AC, "checked", "unchecked") AS StrAC FROM myTable
If you can use TSQL...