Web Wiz - Green Windows Web Hosting

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

Subscript out of range

 Post Reply Post Reply Page  <12
Author
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post Posted: 09 December 2003 at 6:55pm
Next time the best way to figure this kind of error out is something like this, just insert a:

Response.Write(UBound(arrUser_Name))

Right before the error, that way you can tell if the array is being populated correctly. If you get the right number then try this:

For i = 0 To UBound(arrUser_Name)   'When you use split the array always start at 0 so no need to call LBound...
    Response.Write(arrUser_Name(i) & "<br>")
Next

That way you can save a lot of time and a big headache :-)
FeRnAN
Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post Posted: 09 December 2003 at 7:18pm
Thanks Fernan, will try to remember that. I don't have too much experience with arrays, and i guess they are the easiest way to update multiple records at once with Access DB's.
Back to Top
d80cxq View Drop Down
Newbie
Newbie


Joined: 18 December 2003
Location: United Kingdom
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote d80cxq Quote  Post ReplyReply Direct Link To This Post Posted: 18 December 2003 at 3:41am

Hi,

This is a much simpler problem than the one discussed already, sorry if this is obvious but I am new to ASP and hoping someone can help! I have the following code:

dim hover
dim i

hover =Array("15","10","7","6","8","11")

For each I in hover
   Response.Write hover(i)
Next

But I always get the error:   Subscript out of range: '15'

If I change line 1 to
 dim hover()

I get the error:  Type mismatch

Can anyone enlighten me?
Thanks,
Louise

Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post Posted: 18 December 2003 at 7:32am

This works:

<% Dim i Dim hover hover = Array("15","10","7","6","8","11") For i = 0 To UBound(hover) Response.Write(hover(i) & "
") Next %><% Dim i Dim hover hover = Array("15","10","7","6","8","11") For i = 0 To UBound(hover) Response.Write(hover(i) & "
") Next %><%
Dim i
Dim hover
hover = Array("15","10","7","6","8","11")
For i = 0 To UBound(hover)
 Response.Write(hover(i) & "<br>")
Next
%>

Back to Top
d80cxq View Drop Down
Newbie
Newbie


Joined: 18 December 2003
Location: United Kingdom
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote d80cxq Quote  Post ReplyReply Direct Link To This Post Posted: 18 December 2003 at 9:09am

That worked for me as well - thanks a lot!

I had tried all those elements (Ubound, dim hover, dim hover()) etc but just never got the right combination.

Back to Top
 Post Reply Post Reply Page  <12

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.