...

View Full Version : using tick boxes in an asp form/database



startbar
08-15-2004, 05:11 PM
hello.

if i have an asp form to update a database through ms access how would i go about implementing the use of tick boxes in it? i.e do i have to select 'Tick box' from the type when making the database? how wold the data be displayed etc..? sorry bit vague i know!

thanks in advance!

oracleguy
08-15-2004, 06:54 PM
You mean checkboxes? In Access they are called Yes/No fields when you design the table and believe they return true or false when queried and you can use true/false to set the value using SQL. It just a boolean field basically they just don't call it that in access, lol.

Morgoth
08-15-2004, 09:02 PM
Or if you mean radio boxes, it would be the same as what oracleguy said.

If you wish to know how to put the checkboxs results from a database back into checkboxes on a form this recent reply will help you :)
http://www.codingforums.com/showthread.php?t=43306#post226362

angst
08-15-2004, 09:44 PM
ya but i'm not selecting from multiple columns,
i'm selecting from one column, with values sparated by comas,

if thats the way this code works, then i don't understand it,



Dim SQL, oRS, I, strOption(8)

SQL = "SELECT fldOption1, fldOption2, fldOption3, fldOption4, fldOption5, fldOption6, fldOption7, fldOption8 FROM tblForm WHERE ID = " & SelectedID
Set oRS = oConn.Execute(sSQL)

For I = 1 To 8
If oRS("fldOption" & I) = True Then
strOption(I) = " checked"
Else
strOption(I) = ""
End If
Next
%>

<input name="option1" type="checkbox"<%=strOption(1)%>>
<input name="option2" type="checkbox"<%=strOption(2)%>>
<input name="option3" type="checkbox"<%=strOption(3)%>>
<input name="option4" type="checkbox"<%=strOption(4)%>>
etc...

Morgoth
08-15-2004, 11:02 PM
ya but i'm not selecting from multiple columns,
i'm selecting from one column, with values sparated by comas,

if thats the way this code works, then i don't understand it,



Dim SQL, oRS, I, strOption(8)

SQL = "SELECT fldOption1, fldOption2, fldOption3, fldOption4, fldOption5, fldOption6, fldOption7, fldOption8 FROM tblForm WHERE ID = " & SelectedID
Set oRS = oConn.Execute(sSQL)

For I = 1 To 8
If oRS("fldOption" & I) = True Then
strOption(I) = " checked"
Else
strOption(I) = ""
End If
Next
%>

<input name="option1" type="checkbox"<%=strOption(1)%>>
<input name="option2" type="checkbox"<%=strOption(2)%>>
<input name="option3" type="checkbox"<%=strOption(3)%>>
<input name="option4" type="checkbox"<%=strOption(4)%>>
etc...



Looks like you posted in the wrong theard. I replyed in the real thread.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum