LongFeiFengWu
Technical User
I have a SELECT statement that I'm using to generate a table. One of the variables in the statement comes from a form field "item". The form field is carrying the value to this page correctly and the column in the table does exist, but I'm getting the following error message when the code runs:
Item cannot be found in the collection corresponding to the requested name or ordinal.
I have marked the errored lines in red below. Any help is greatly appreciated.
"If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo." ~ Bruce Lee
Item cannot be found in the collection corresponding to the requested name or ordinal.
I have marked the errored lines in red below. Any help is greatly appreciated.
Code:
<%
IF "" & request.form("D1") <> "" THEN
D1 = request.form("D1")
D2 = request.form("D2")
item = request.form("item")
SQL = "SELECT COUNT(ID) AS CID, "& item &" FROM Visits WHERE VisitDate BETWEEN #"& D1 &"# AND #"& D2 &"# "
SQL = SQL & "GROUP BY "& item &" "
objrec.open SQL,objcon,3,3
IF objrec.recordcount > 0 THEN
do while not objrec.eof
Link = "<a href='/ChanInn/index.asp?page=listvisit&D1="& D1 &"&D2="& D2 &"&item="& [COLOR=red]objrec(request.form("item"))[/color] &"'>"
CID = objrec("CID")
response.write "<tr>"
response.write "<td align=center colspan=2>"& LINK & [COLOR=red]objrec(request.form("item"))[/color] &"</td>"
response.write "<td align=center colspan=2>"& CID &"</td>"
response.write "</tr>"
objrec.movenext
loop
END IF
END IF
%>
"If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo." ~ Bruce Lee