Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Closed Thread
Subscript out of range
Old 11-16-2005, 07:19 AM Subscript out of range
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
Hi,
Could someone tell me why gettingthe below error :

Subscript out of range: '[number: 5]'

/dashboard/fulfilment/SAP/Reference/SAPFile_MakeYesterday.asp, line 126

for code :

If CurrItemSKU <> aOrder(ITEMSKU, i) Then
.GetNextItem()
CurrItemSKU = aOrder(ITEMSKU, i)
End If
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 11-16-2005, 07:37 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
either ITEMSKU or i is greater than the number of elements in the array;

again a bit of basic debugging is needed
use response.write to show the values of the variables and the array element size
ubound(array_name,dimension) will tell you the array size

You need to use some error checking in your application to ensure that user input (from forms or database) does not "break" your code and present the user with an error message.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 11-16-2005, 07:46 AM
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
cheers but when i do


response.write(ubound(aOrder,dimension)) & "<br>" ' (line 127)

I get the error :


Subscript out of range: 'UBound'

/dashboard/fulfilment/SAP/Reference/SAPFile_MakeYesterday.asp, line 129
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
View Public Profile Visit numbenator's homepage!
 
Old 11-16-2005, 07:59 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
and the value of dimension is ??

for your array it will need to be 1 or 2. Where 1 will tell you how many rows and 2 will tell you how many columns. So an array dimmed as
Code:
dim array_name(10,2)
using ubound(array_name,1) will return 10, and ubound(array_name,2) will return 2
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 11-16-2005, 01:05 PM
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
Thats great thanks for your time.
Perhaps you could answer one other question.
How do I add an element to an array?
I have a variable=oRS.getRows.
I require to add a value to the array.

How do I do this please.
Thanks for you time

Steve
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
View Public Profile Visit numbenator's homepage!
 
Closed Thread     « Reply to Subscript out of range
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20937 seconds with 12 queries