Discussion:
Microsoft VBScript runtime error '800a0009'
(too old to reply)
Justin Doh
2006-02-23 19:57:07 UTC
Permalink
I am getting this error on my website.

Microsoft VBScript runtime error '800a0009'
Subscript out of range: '[number: 3]'

C:\CONTENT\../redboard/outlogin.asp, line 195

Any comment would be appreciated.

Thanks.
Justin
W C Hull
2006-02-24 01:07:12 UTC
Permalink
Well, usually it means just what it says. Typically this occurs when you
are attempting to acquire a varible from an array and the array doesn't
contain the required number of elements. Heres an example.... say you have
a varible (i.e. Fruit) of an ARRAY type that has 3 elements (i.e. Apples,
Oranges, Peaches in that order). If you want apples you would specify
Fruit(0). If you want Peaches you would specify Fruit(2). If you specify
Fruit(3) you will get the subscript out of range because there are only 3
elements in the array and arrays always start with Zero as the first
element. Note that I think you can get the same type error if you don't
know that the varible in question is an array and don't specify the index
value for it. For example, if you think that Fruit is a simple string
variable containing the String "apples" and Fruit is really an array with 3
elements as noted above you would get the same type of error if you tired to
use Fruit like TodaysFruit = Fruit
Post by Justin Doh
I am getting this error on my website.
Microsoft VBScript runtime error '800a0009'
Subscript out of range: '[number: 3]'
C:\CONTENT\../redboard/outlogin.asp, line 195
Any comment would be appreciated.
Thanks.
Justin
Michael Harris (MVP)
2006-02-24 01:12:45 UTC
Permalink
Post by Justin Doh
I am getting this error on my website.
Microsoft VBScript runtime error '800a0009'
Subscript out of range: '[number: 3]'
C:\CONTENT\../redboard/outlogin.asp, line 195
Any comment would be appreciated.
Thanks.
Justin
VBScript arrays (are COM SAFEARRAYs and) use 0 based indexing.

Dim myArray(2) ' 3 element array
Dim i
for i=0 to 2 'better: to ubound(myArray)
myArray(i) = "element" & i
next
for i=0 to 2 'better: to ubound(myArray)
wscript.echo myArray(i)
next
--
Michael Harris
Microsoft MVP Scripting

Scripting: Your First Steps
http://www.microsoft.com/technet/scriptcenter/topics/beginner/firststeps.mspx
Elijah Oliver
2010-03-24 14:31:34 UTC
Permalink
I need help I am getting:
Microsoft VBScript runtime error '800a0009'

url:http://www.ureader.com/msg/16754779.aspx
mayayana
2010-03-24 15:49:50 UTC
Permalink
It helps if you post the error description. Most
people don't memorize the numbers, and there's
no reason we should have to follow a webpage link
to get the description.

It also helps to post code. Nobody can offer
much help if they have no idea of what your
script looks like. Best is if you post the part
that's giving you trouble and note the line where
the error happens.

As your link explains, "subscript out of range"
usually means that you're trying to access an array
index that doesn't exist. "Subscript" is just an
excessively fancy way of saying "index". The typical
way that problem happens is by mixing up the
start point: Collections start with 1. A string's
length is measured starting at 1. But an array
begins at 0.
Post by Justin Doh
Microsoft VBScript runtime error '800a0009'
url:http://www.ureader.com/msg/16754779.aspx
Al Dunbar
2010-03-24 23:53:52 UTC
Permalink
Post by mayayana
It helps if you post the error description. Most
people don't memorize the numbers, and there's
no reason we should have to follow a webpage link
to get the description.
It also helps to post code. Nobody can offer
much help if they have no idea of what your
script looks like. Best is if you post the part
that's giving you trouble and note the line where
the error happens.
As your link explains, "subscript out of range"
usually means that you're trying to access an array
index that doesn't exist. "Subscript" is just an
excessively fancy way of saying "index". The typical
way that problem happens is by mixing up the
start point: Collections start with 1. A string's
length is measured starting at 1. But an array
begins at 0.
Good answer. I was simply going to respond that he can find the answer to
his question here:

http://www.ureader.com/msg/16754779.aspx


/Al
Post by mayayana
Post by Justin Doh
Microsoft VBScript runtime error '800a0009'
url:http://www.ureader.com/msg/16754779.aspx
Loading...