Microsoft VBScript runtime error '800a0009'


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Microsoft VBScript runtime error '800a0009'

  1. #1
    Join Date
    Dec 2006
    Posts
    3

    Microsoft VBScript runtime error '800a0009'

    Hi,

    I have a error that I cannot figure out, and I am not too familiar with VB code, and I am pretty sure it is really obvious what the problem is but I have no idea what is causing it or how to fix it, so any help, hints, clues or suggestions would be great

    Error:
    Microsoft VBScript runtime error '800a0009'

    Subscript out of range: '16'

    /quote/temp_screenprintquote_results1.asp, line 67

    (thank you for taking the time to read this huge email and trying to figure out my crazy hacked code)

    Code:
    <%
    Dim numCT
    shirt = request.form("shirt")
    price = request.form("pricew")
    numC = CLNG( request("numberOfColors") )
    numCb = CLNG( request("numberOfColorsb") )
    numCr = CLNG( request("numberOfColorsr") )
    numCl = CLNG( request("numberOfColorsl") )
    qty = CLNG( request("quantityOrdered") )
    numCT = (numC + numCb + numCr + numCl)
    %>

    <%
    dim total
    Dim colorPriceTable
    colorPriceTable =Array(_
    Array(6, 12, 24, 48, 72, 144, 288, 500, 1000, 2001, 999999),_
    Array(4, 2.5, 1.6, 1.15, 1.1, .9, .75, .65, .6, .55, .5),_
    Array(7, 3.1, 2.45, 1.9, 1.5, 1.35, 1, .85, .8, .7, .65),_
    Array(8.5, 4, 3, 2.85, 1.95, 1.65, 1.45, 1.3, 1, .85, .8),_
    Array(10.5, 4.7, 3.6, 3.45, 2.35, 1.9, 1.7, 1.6, 1.3, 1, .9),_
    Array(12, 5.4, 4.25, 4.05, 2.75, 2.2, 1.95, 1.9, 1.5, 1.15, 1),_
    Array(13, 6.3, 5.05, 4.75, 3.35, 2.7, 2.35, 2.2, 1.7, 1.3, 1.1),_
    Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)_
    )

    priceRow = colorPriceTable(numC)
    priceRowb = colorPriceTable(numCb)
    priceRowr = colorPriceTable(numCr)
    priceRowl = colorPriceTable(numCl)
    priceRowt = colorPriceTable(numCT)

    qtyRow = colorPriceTable(0)

    if numC = 7 Then
    unitPrice = 0
    End If

    if numCb = 7 Then
    unitPriceb = 0
    End If

    if numCr = 7 Then
    unitPricer = 0
    End If

    if numCl = 7 Then
    unitPricel = 0
    End If

    if numCT = 7 Then
    unitPriceT = 0
    End If

    unitPrice = 0
    usecol = 0

    For col = 0 To UBound(qtyRow)
    If qty < qtyRow(col) Then
    unitPrice = priceRow(col)
    unitPriceb = priceRowb(col)
    unitPricer = priceRowr(col)
    unitPricel = priceRowl(col)
    unitPriceT = priceRowt(col)
    Exit For
    End If

    Next
    if numC = 7 Then
    numC = 0
    End If

    if numCb = 7 Then
    numCb = 0
    End If

    if numCr = 7 Then
    numCr = 0
    End If

    if numCl = 7 Then
    numCl = 0
    End If

    if numCT = 7 Then
    numCT = 0
    End If

    total = ((((unitPriceT * qty) + (price * qty) + (.25 * qty))* 1.54) + (numCT * 22))
    %>

    Thanks Again and hopefully your headache is not too bad

    Jen

  2. #2
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    where the error point exactly ? I mean in which line ?

    I guess the out of range occure in the boumds of your arrays maybe for example in the for loop .. just send us where it gives u error .
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  3. #3
    Join Date
    Dec 2006
    Posts
    3
    Hi, Here is the exact error:

    Microsoft VBScript runtime error '800a0009'

    Subscript out of range: '22'

    /quote/temp_screenprintquote_results1.asp, line 67

    The offending line of code is:
    priceRowt = colorPriceTable(numCT)

    There are probably more offenders, but I have not yet seen them.

    Thanks,
    Jen

  4. #4
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    numCT is greater than the bound of the colorPriceTabel() array bound ;

    this line :
    numCT = (numC + numCb + numCr + numCl)
    must be changed I guess as it sometimes put in numCT a bound greater than the array's .

    hope this helps ?
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  5. #5
    Join Date
    Dec 2006
    Posts
    3
    Is there a way I can add up the numC's into 1 variable so I can then use it without it being greater than the bound?

  6. #6
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    u must increase the bound of your array :
    your array hase only 7 items , each of them has it's owen array ;
    it seems that the sum is greater than 7 then or u increase the bound with empty items say or use a different method depends on what's your programme do ..
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

Similar Threads

  1. MS-Access Error - Obsolet Database Format !
    By Makl. Lemmertz in forum VB Classic
    Replies: 2
    Last Post: 10-29-2001, 12:12 PM
  2. VBScript runtime error.......
    By mun in forum Web
    Replies: 1
    Last Post: 08-13-2001, 06:31 PM
  3. Microsoft Opportunity in DC
    By Tom Jarosz in forum Mobile
    Replies: 0
    Last Post: 03-14-2001, 11:35 AM
  4. Sun, Microsoft, & Copyrights
    By Zane Thomas in forum .NET
    Replies: 5
    Last Post: 01-27-2001, 05:33 AM
  5. Microsoft Kabuki
    By Robert Radina in forum Talk to the Editors
    Replies: 9
    Last Post: 04-16-2000, 02:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center