I am running into a problem while trying to run a case statement. Here is a little background. I have a form with 10 checkboxes, all with the same name but different values (values range from 1 to 10). The user can select anywhere from 1-9 of the boxes OR the tenth which is a "none apply." I parse this data and sent it to an Access Database where the values are stored with a common ID (i.e. if the user selects the boxes with values 1,4,7 they are all stored with the same ID).
In addition to this I have a modify form that I want the user to be able to modify checkbox selections. To do this I want to display all the checkboxes AND for the ones that they have selected, I want them to be checked. To do this I have written the following case statements that should (at least in my mind!!!) check these boxes, as well as format them properly.
For MsnID = 1 to 10
Select Case MsnID
Case 1,4,7
If objRS("MissionID" = MsnID then
response.write "<tr><td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"" checked>" & objMissionRS("MissText" & "</td>"
else
response.write "<tr><td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"">" & objMissionRS("MissText" & "</td>"
end if
Case 2,5,8
If objRS("MissionID" = MsnID then
response.write "<td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"" checked>" & objMissionRS("MissText" & "</td>"
else
response.write "<td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"">" & objMissionRS("MissText" & "</td>"
end if
Case 3,6,9
If objRS("MissionID" = MsnID then
response.write "<td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"" checked>" & objMissionRS("MissText" & "</td></tr>"
else
response.write "<td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"">" & objMissionRS("MissText" & "</td></tr>"
end if
Case 10
If objRS("MissionID" = MsnID then
response.write "<tr><td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"" checked>" & objMissionRS("MissText" & "</td></tr>"
else
response.write "<tr><td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"">" & objMissionRS("MissText" & "</td></tr>"
end if
End Select
The problem I am having is that I am getting an "exception Occured" then I try to run this. The error always references the "If objRS("MissionID" = MsnID then" line and it references it in different cases, depending on the number of the boxes selected.
I would greatly appreciate any help that can be offered.
Thanks, Jason
In addition to this I have a modify form that I want the user to be able to modify checkbox selections. To do this I want to display all the checkboxes AND for the ones that they have selected, I want them to be checked. To do this I have written the following case statements that should (at least in my mind!!!) check these boxes, as well as format them properly.
For MsnID = 1 to 10
Select Case MsnID
Case 1,4,7
If objRS("MissionID" = MsnID then
response.write "<tr><td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"" checked>" & objMissionRS("MissText" & "</td>"
else
response.write "<tr><td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"">" & objMissionRS("MissText" & "</td>"
end if
Case 2,5,8
If objRS("MissionID" = MsnID then
response.write "<td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"" checked>" & objMissionRS("MissText" & "</td>"
else
response.write "<td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"">" & objMissionRS("MissText" & "</td>"
end if
Case 3,6,9
If objRS("MissionID" = MsnID then
response.write "<td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"" checked>" & objMissionRS("MissText" & "</td></tr>"
else
response.write "<td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"">" & objMissionRS("MissText" & "</td></tr>"
end if
Case 10
If objRS("MissionID" = MsnID then
response.write "<tr><td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"" checked>" & objMissionRS("MissText" & "</td></tr>"
else
response.write "<tr><td><INPUT TYPE=checkbox NAME=""mission"" VALUE=""MsnID"">" & objMissionRS("MissText" & "</td></tr>"
end if
End Select
The problem I am having is that I am getting an "exception Occured" then I try to run this. The error always references the "If objRS("MissionID" = MsnID then" line and it references it in different cases, depending on the number of the boxes selected.
I would greatly appreciate any help that can be offered.
Thanks, Jason