Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using arrays in while loop

Status
Not open for further replies.

parames

MIS
Jun 26, 2000
71
MY
Hi list,
I get this error message when run this script:

-------
Do while Not RS.EOF
dim tbl_array(5)
tbl_array(0) = "fg_lcb"
tbl_array(1) = "fg_r9"
tbl_array(2) = "pp"
tbl_array(3) = "fg_r3a"
tbl_array(4) = "fg_sheet"
tbl_array(5) = "fg_slitter"

for i=0 to 5
Query1 = "SELECT * from "&tbl_array(i)&" where serial ='"&RS("serial")&"' and weight='"&RS("weight")&"'"
Set RS1 = Conn.Execute(Query1)

If Not RS1.EOF then
got_rec = "YES"
machine = tbl_array(i)
exit for
end if
next

---------

The error message is:
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'tbl_array'
/online/production/grn/grn_match.asp, line 75

line 75 == dim tbl_array(5)

If i run this script without the while loop, there is no error..

How to solve this..
Please help..

Thanks and Best regards,
Parameswari sellaparma
 
Try dim'ing the array outside the loop and just redimming it at the top of every loop to clear it:
Code:
Dim tblArray()
Do While Not RS.EOF
   ReDim tblArray(5)
...etc

Not sure if that would make a difference or not.
-Tarwn ________________________________________________
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
try Dim'ing it as (6) instead of (5)
=========================================================
if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top