Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Subscript out of range ERROR
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Subscript out of range ERROR

 Post Reply Post Reply
Author
lw_trumpet View Drop Down
Newbie
Newbie


Joined: 29 January 2004
Location: United States
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote lw_trumpet Quote  Post ReplyReply Direct Link To This Post Topic: Subscript out of range ERROR
    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

 

Back to Top
aalavar View Drop Down
Groupie
Groupie


Joined: 08 December 2003
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote aalavar Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.