|
-
Apr 2nd, 2004, 11:02 PM
#1
Thread Starter
Addicted Member
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?
-
Apr 3rd, 2004, 08:27 AM
#2
Re: Checkbox values
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%>>
[VBF RSS Feed]
There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.
If I have been helpful, Please Rate my Post. Thanks.
This post was powered by : 
-
Apr 6th, 2004, 08:26 AM
#3
Hyperactive Member
Or modify your SQL statement
SELECT IIF(AC, "checked", "unchecked") AS StrAC FROM myTable
If you can use TSQL...
"Experience is something you don't get until just after you need it."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|