H:ReDim not working as expected 
Author Message
 H:ReDim not working as expected

  I'm trying to make a dynamic array based upon a field in a database.
If the field matches an existing value, add 1 to the second part of the
array.  When I ReDim, I get a runtime error 9.  Any suggestions?

Jereme

    Dim Zip(), I As Double, N As Double

    ReDim Zip(0, 2)

    Do Until datagraph1.Recordset.EOF
        Total = Total + 1

        If datagraph1.Recordset.Fields(8) <> "" And
datagraph1.Recordset.Fields(10) <> "" Then
            CloseS = CloseS + 1
        End If

        If datagraph1.Recordset.Fields(10) <> "" Then
            TotalC = TotalC + 1
        End If

        'Check the zip codes
        For I = LBound(Zip, 1) To UBound(Zip, 1)
            If Zip(I, 1) = datagraph1.Recordset.Fields(3) Then
                Zip(I, 2) = Zip(I, 2) + 1
                Exit For
            Else
                If UBound(Zip, 1) = I Then
                    N = I + 1

                    ReDim Preserve Zip(N, 2)    'Gets stuck here, error
9

                    Zip(N, 1) = datagraph1.Recordset.Fields(3)
                    Zip(N, 2) = 1
                    Exit For
                End If
            End If

        Next

        datagraph1.Recordset.MoveNext

    Loop



Sun, 13 Feb 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Range.Collapse not working as expected

2. SetFocus Property on TextBox Does Not Work as Expected (Q237863)

3. Recorded Macro Does Not Work As Expected

4. Recorded Macro Does Not Work as Expected

5. ItemCheck event on Listviews not working as expected

6. Object Serialization not working as expected

7. Button and hotkey (do not work as expected)

8. Will Move command not working as expected

9. RegEnumValue API not working as I'd expect

10. Combo box and mousepointer not working as expected

11. Public Enum not working as expected

12. VB5 does not work as expected in a batch file

 

 
Powered by phpBB® Forum Software