The problem is that the checkboxes are created dynamically Here is my code....
<% @LANGUAGE=VBscript %>
<% Option Explicit %>
<html>
<head>
<title>Select sub categories</title>
</head>
<body>
<form action="catgorysel.asp" method="post" name="subcategory">
<%
Response.Buffer = True
Dim dbConn 'Common Database connection
Dim rsMain 'Common recordset object
Dim rsSub
Dim strSQL 'SQL string constructor
Dim fld
Dim counter
Dim ArrayCheck(100)
Dim ArraySize
ArraySize = 0
'Get the database connection
Set dbConn = Server.CreateObject( "ADODB.Connection" )
dbConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath( "ckbx.mdb" ) & ";"
'Get the main categories from the database. All we need at the moment is the identities
strSQL = "SELECT GroupID FROM [Main_Categories]"
Set rsMain = dbConn.Execute( strSQL )
If rsMain.EOF Then
Response.Redirect "MAJORERROR.ASP"
End If
'Scan the form looking for checked boxes
While NOT rsMain.EOF
fld = Request.Form( "ck" & rsMain("GroupID"

) 'Get the field from the form
If NOT (fld = False) Then 'Was the box checked
ArrayCheck( ArraySize ) = rsMain("GroupID"

'Add the GroupID to the array
ArraySize = ArraySize + 1 'Increment the array size
End If
rsMain.MoveNext 'Next database record
Wend
Set rsMain = Nothing
'Check that something was selected
If ArraySize = 0 Then
Response.Redirect "NOTHINGSELECTED.ASP"
End If
'Make the SQL string for the group selection
strSQL = "SELECT GroupID, Description FROM [Main_Categories] WHERE "
'Make our way through the array making the selections we want
For counter = 0 To ArraySize - 1
If counter > 0 Then strSQL = strSQL & " OR " 'Put the OR in if required
strSQL = strSQL & "(GroupID=" & ArrayCheck(counter) & "

"
Next
'Now sort the output
strSQL = strSQL & " ORDER BY Description"
'Get the sorted records we want from the database
Set rsMain = dbConn.Execute( strSQL )
If rsMain.EOF Then
Response.Redirect "MAJORERROR.ASP"
End If
'Start the main category display loop
While NOT rsMain.EOF
'Write the table header
Response.Write( "<table align=""center"">" & vbCrLf )
'Write the title of the current selection block (or main category description)
Response.Write( "<tr><td colspan=""2""><h1>" & rsMain("Description"

& "</h1></td></tr>" & vbCrLf )
'--------------------------- BEGIN OF SUB-CATEGORY SECTION -------------------------
'Make the SQL string. We need all the categories that belong to the current main group
'and sort them into alphabetical order
strSQL = "SELECT CategoryID, Description FROM [Sub_Categories] " & _
"WHERE GroupID=" & rsMain("GroupID" ) & _
" ORDER BY Description"
'Open the recordset
Set rsSub = dbConn.Execute( strSQL )
'Is there actually anything here
If NOT rsSub.EOF Then
'Start the scan loop
While NOT rsSub.EOF
'This is pretty much the same thing as in category.asp
%>
<tr><td><%=rsSub("Description"

%></td>
<td><input type="checkbox" name="catbox<%=rsSub("CategoryID"

%>"></td>
</tr>
<%
rsSub.MoveNext
Wend
End If
'Clean up recordset object
Set rsSub = Nothing
'---------------------------- END OF SUB-CATEGORY SECTION --------------------------
'End of the category table
Response.Write( "</table><br><br>" & vbCrLf )
rsMain.MoveNext
Wend
'--------- Display the submit and reset buttons ------------------------
%>
<div align="center">
<input type="submit" value="Submit Form"> <input type="Reset" value="Reset Form">
</div>
</form>
</body>
</html>
<%
'Clean up database
dbConn.Close
Set dbConn = Nothing
%>