Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error message that I can't figure out

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
What does this error mean? The items do exist in the table I am pulling from and they are spelled correctly What am I missing???

Error Type:
ADODB.Fields (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.

 
If I take out everything but the requesting the loginID it works, but when I request the other stuff I get that error message.

<%dbrs.open (&quot;Select distinct loginID From Timesheet where month = '&quot; & request.Form(&quot;select1&quot;) & &quot;'&quot;), dbconn, 0, 1 %>
<table width=&quot;50%&quot; border=&quot;1&quot; style=&quot;border-collapse: collapse; font-family:Times New Roman; font-size: 10pt&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; bordercolor=&quot;#000000&quot; id=&quot;health&quot;>
<tr>
<td width=&quot;31%&quot;>Username:</td>
<td width=&quot;21%&quot;>25 Mile Club</td>
<td width=&quot;20%&quot;>50 Mile Club</td>
<td width=&quot;23%&quot;>Stair Climbers</td>
</tr>
<% dbrs.movefirst %>
<% Do While NOT dbrs.EOF %>
<tr>
<td><%=(dbrs.Fields.Item(&quot;loginID&quot;).Value)%></td>
<td><%=(dbrs.Fields.Item(&quot;twentymiles&quot;).Value)%></td>
<td><%=(dbrs.Fields.Item(&quot;fiftymiles&quot;).Value)%></td>
<td><%=(dbrs.Fields.Item(&quot;stairclimbers&quot;).Value)%></td>
</tr>
<% dbrs.movenext %>
<% loop %>
</table>
 
You can't get any of the other values because they are not in your select statement.

<%dbrs.open (&quot;Select distinct loginID From Timesheet where month = '&quot; & request.Form(&quot;select1&quot;) & &quot;'&quot;), dbconn, 0, 1 %>


You are only selecting the LoginID here.
 
So how would you rewrite the SQL statement so it pulls all of that but only displays the loginID once. For each month it is listed several times.
 
I am not sure I understand your question, but if you want to display the rest of that info, it has to be in your select statement:

Select distinct loginID, twentymiles, fiftymiles, stairclimbers From Timesheet where month = '&quot; & request.Form(&quot;select1&quot;) & &quot;'&quot;

But perhaps you should explain what data is in your table and what you are trying to display.
 
And you also need to add a GROUP BY clause to the end of your SQL. You need to group the select by the distinct value(s), so GROUP BY loginID may work for you. Einstein47
(Love is like PI - natural, irrational, endless, and very important.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top