Print Page | Close Window

Subscript out of range ERROR

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=9356
Printed Date: 01 April 2026 at 2:33am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Subscript out of range ERROR
Posted By: lw_trumpet
Subject: Subscript out of range ERROR
Date Posted: 29 January 2004 at 11:30am

I'm hoping someone can help.  I can't figure out what's causing this error when I display the result of this code.

Microsoft VBScript runtime error '800a0009'

Subscript out of range: '7'

/featuredfirms.asp, line 126

I'm trying to list results from a table where I have lookup codes that correspond from another table.  Here's my code...

<%  
 strfirmpracticeareas=objRSfeature("firmPracticeareas")
 dim practiceArr, StrSql, objRSpracticearea
 practiceArr = split(strfirmpracticeareas,",")
 Set objRSpracticearea = Server.CreateObject("ADODB.RecordSet")
 StrSql = "Select practicename from practice Where practiceid = " & practiceArr(x)
 
 for x = LBound(practiceArr) to UBound(practiceArr)
  StrSql = StrSql & " OR practiceid = " & practiceArr(x)
 next
  
  
 objRSpracticearea.Open StrSql, objConn, 3, 3
 
 Do While Not objRSpracticearea.EOF
  Response.Write "<b>" & objRSpracticearea("practicename") & "</b>, &nbsp;"
 objRSpracticearea.MoveNext
 Loop
         
    objRSpracticearea.close
    Set objRSpracticearea=Nothing
  
   %>

Thanks, in advance

 




Replies:
Posted By: aalavar
Date Posted: 29 January 2004 at 8:54pm

Where did you define x before this line:

StrSql = "Select practicename from practice Where practiceid = " & practiceArr(x)

You can either change that to practiceArr(0) or define x as 0, then use 1 to ubound in the for loop.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net