I'm getting a runtime error on a for next loop and need: Here's my code:

<%
for i=1 to Trim(UCase(Request.QueryString("print"))).Count
If Trim(UCase(Request.QueryString("print"))) (i) = Trim(UCase(rsAuto.Fields.Item("vin").Value)) Then %>
        <tr>
          <td width="10%" height="45" align="center" valign="middle"><%=(rsAuto.Fields.Item("year").Value)%></td>
          <td width="15%" align="center" valign="middle"><%=(rsAuto.Fields.Item("make").Value)%></td>
          <td width="30%" align="center" valign="middle"><%=(rsAuto.Fields.Item("vin").Value)%></td>
          <td width="15%" align="center" valign="middle"><%=(rsAuto.Fields.Item("title").Value)%></td>
          <td width="25%" align="center" valign="middle"><%=(rsAuto.Fields.Item("ticket").Value)%></td>
          <td align="middle" valign="middle"><%=(rsAuto.Fields.Item("color").Value)%>&nbsp;</td>
        </tr>
        <%
 End If
 Next
 %>

The Error I'm getting is:

Microsoft VBScript runtime error '800a01a8'
Object required: '[string: "1G4HR52K7VH448793, 2"]'

Looking at the URL parameters that are being passed it's not putting the value in the number 2 spot like I thought it would. I get the same error when only one option is being passed as well.

Thank you for any help.

Natalie

Recommended Answers

All 2 Replies

try:

<%
'Note: No Trim() nor UCase() after the "to"
for i=1 to Request.QueryString("print").Count

'NOTE: the (i) is adjacent to querystring
If Trim(UCase( Request.QueryString("print")(i) ))  = Trim(UCase(rsAuto.Fields.Item("vin").Value)) Then %>
<tr>
<td width="10%" height="45" align="center" valign="middle"><%=(rsAuto.Fields.Item("year").Value)%></td>
<td width="15%" align="center" valign="middle"><%=(rsAuto.Fields.Item("make").Value)%></td>
<td width="30%" align="center" valign="middle"><%=(rsAuto.Fields.Item("vin").Value)%></td>
<td width="15%" align="center" valign="middle"><%=(rsAuto.Fields.Item("title").Value)%></td>
<td width="25%" align="center" valign="middle"><%=(rsAuto.Fields.Item("ticket").Value)%></td>
<td align="middle" valign="middle"><%=(rsAuto.Fields.Item("color").Value)%>&nbsp;</td>
</tr>
<%
End If
Next
%>

Thank you for your assistance with my issue. I am out of town for a week and will not be able to test the results of the fix on my post until I get back to my office. Hence the urgent request, I was hoping to resolve my problem before I left. I will post a new reply to this thread when I am able to test.

Warmest Regards
sourceskill

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.