From: Justin Doh on 23 Feb 2006 14:57 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
From: W C Hull on 23 Feb 2006 20:07 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 "Justin Doh" <JustinDoh(a)discussions.microsoft.com> wrote in message news:1DC65FF9-28C2-4966-9F05-56D8FDCA8035(a)microsoft.com... >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
From: "Michael Harris (MVP)" <mikhar at mvps dot on 23 Feb 2006 20:12 Justin Doh wrote: > 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
|
Pages: 1 Prev: Login script errors on a blank line Next: ERROR: The pipe is being closed |