I am using the code below to display a list of results in a table. It is working fine except the ".Write rsName1("grp_code")" section (which is looking for results from another table, is displaying the same value for every record of rsname. How can I get it (rsname1) to display the correct value which matches the record from rsname?
strSQL = "SELECT * FROM Student WHERE syskey = '" & request("syskey") & "'"
stucode = rsname("syskey")
acyear = "03/04"
strSQL1 = "SELECT * FROM stu_grp WHERE stu_code = '" & stucode & "' AND ayrc = '" & acyear & "'"
rsName1.Open strSQL1, adoConn, adOpenDynamic ,adLockReadOnly, adCmdText
While not rsName.EOF
With Response
.Write "<tr>"
.Write "<td>"
.Write rsName("syskey")
.Write "</td>"
.Write "<td>"
.Write rsName("firstname")
.Write "</td>"
.Write "<td>"
.Write rsName("lastname")
.Write "</td>"
.Write "<td>"
.Write rsName("dob")
.Write "</td>"
.Write "<td>"
'*******PROBLEM LINE!!*********
'***DISPLAYS SAME VALUE FOR EVERY RECORD***
.Write rsName1("grp_code")
.Write "</td>"
.Write "</tr>"
end with
'Moves to the next record
rsName.MoveNext
wend
end if
Please help!