Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

Type Mismatch

$
0
0
I am connecting to an XML file with vbscript and looping through some of the elements.
In the loop I have 3 arrays I have to use during the loop. At the end of the loop before the Next statement I have to reset the arrays for the next iteration of the loop.

I'm getting a type mismatch error pointing to the Dim statement for the 3 arrays. Can some one tell me why I am getting this error?

Here is some code:

Code:

'I start the loop above this portion.
Dim PackagesArray(), OffersArray(), QTYArray()

Set Offers = PMORDXMLDOM.SelectNodes("//OfferType")

                For Each SpecificOffer In Offers
                        Set objSubNode = SpecificOffer.SelectSingleNode("OfferId")
                       
                        If objSubNode.Text <> "Fragile/This End Up Label" Then
                                ReDim Preserve OffersArray(counter)
                                LineItem = objSubNode.Text
                                OffersArray(counter) = LineItem

                                Set QTY = SpecificOffer.SelectSingleNode("OrderQty")
                                ReDim Preserve QTYArray(counter)
                                QTYArray(counter) = QTY.Text
                                counter = counter + 1
                        End If
                Next

                '....More code using the Arrays
               
         
                Erase PackagesArray
                Erase OffersArray
                Erase QTYArray
          '.....move to the next record in the loop


Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>