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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

type mismatch in a simple array code?

Status
Not open for further replies.

jfdabiri

MIS
Feb 27, 2007
282
US
hi,
i have this array and the following code:
Code:
dim hold_book_id(10)
j = 6
for i = 1 to j - 1 
    if hold_book_id(i) = hold_book_id(i+1) then 
       hold_assign_end_date (I) = hold_assign_beg_date (I+1)
    end if 
next
i'm getting a type mismatch error on the if statement.
any ideas?
thanks.
 
It is related to hold_assign_end_date? period.
 
no, it's related to

if hold_book_id(i) = hold_book_id(i+1) then....


it errors out even when i take out hold_assign_end_date
when i try the same code in vbscript .vbs, it works, but when i put it in .asp, it errors out.
 
it even errors out when i try this:

if hold_book_id (1) = hold_book_id (2) then
response.write "two items are equal"
end if
 
I have to be making more effort to become a better believer on supernatural.
 
How is the hold_book_id array populated ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
They posted this.Quote.

dim hold_book_id(10)
j = 6
for i = 1 to j - 1
if hold_book_id(i) = hold_book_id(i+1) then

Unquote.

There is no problem of comparing "uninitiated" in-range array elements which is Empty (a keyword). It is Empty=Empty and will be evaluated to true. (Different behaviour for null.) If there are actually initializations taken place between the dim and the if, why do they spare that part in the post? (In any case, that is bad judgement.)

As to vbs and asp..., that is pure imagination and not to the point.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top