using dynamic arrays

Results 1 to 4 of 4

Thread: using dynamic arrays

  1. #1
    Join Date
    Dec 1969

    Default using dynamic arrays

    Regarding the user poll, I&#039ve used a dynamic array to hold all of the voting options. But when I run it, there&#039s an error:<BR>Microsoft VBScript runtime error &#039 800a0009&#039 <BR><BR>Subscript out of range: &#0390&#039 <BR>(which refers to dynamic arrays). Please help. I don&#039t how I can debug this. Thanks<BR><BR> Dim PollOptions<BR> Redim PollOptions(RSPoll.RecordCount,2)<BR><BR> Dim iCount, iTotalVotes, strPollName<BR> iCount = 0<BR> iTotalVotes = 0<BR> <BR> strPollName = CStr(RSPoll("PollQuestion"))<BR><BR> Do While Not RSPoll.EOF<BR> PollOptions(iCount,1) = CInt(RSPoll("Votes"))<BR> PollOptions(iCount,2) = CStr(RSPoll("QuestionText"))<BR> iTotalVotes = iTotalVotes + PollOptions(iCount,1)<BR> iCount = iCount + 1<BR> <BR> <BR> RSPoll.MoveNext<BR> Loop

  2. #2
    jason Guest

    Default RE: using dynamic arrays

    i don&#039t reckon you should be using EOF<BR><BR>you should use a for loop i.e.<BR><BR>for x = 0 to UBound(yourArray)<BR><BR>EOF is a Recordset property<BR><BR>jason<BR><BR><BR>

  3. #3
    jason (again) Guest

    Default RE: using dynamic arrays

    although i reckon i just misread your code.<BR><BR>j

  4. #4
    jason Guest

    Default RE: using dynamic arrays - definitely misread the

    OK. if you&#039re going directly from a Recordset to an &#039Array&#039, I&#039d recommend putting it in a dictionary object rather than a VBScript Array.<BR><BR>that&#039s it, i&#039m saying no more lest i get it wrong again. doh.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts