Redim subscript out of range? 
Author Message
 Redim subscript out of range?

Hi,


        rows = 0
        While ret = CS_SUCCEED Or ret = CS_ROW_FAIL
            ret = cmd_ptr.vbct_fetch(CS_UNUSED, CS_UNUSED, CS_UNUSED,
outlen)
            If ret = CS_SUCCEED Then
                If rows = 0 Then
                    rows = 1
                Else
                    rows = UBound(Tuples, 1)
                End If
                ReDim Preserve Tuples((rows + 1), 9) '****HERE******
                For Col = 1 To ncols.Data
                    Tuples(rows - 1, Col - 1) = cmd_ptr.vbct_data(Col)
                Next Col
            End If
        Wend
Above is code for my SQL Sombrero. What it does is retrieve sybase rows
line by line. The problem is that if I leave Preserve statement the
ReDim fails with subscript out of range error. I made sure that I am not
getting into problem where I am decreasing the subscript. So, that's not
the problem.
When I take the Preserve out, then it works.
Any ideas?

--
*****************************************************************************
S. Hoon Yoon (Quant) Merrill {*filter*} Equity Trading,

"Miracle is always only few standard deviations away, but so is
catastrophe."
* Expressed opinions are often my own, but NOT my employer's.
"I feel like a fugitive from the law of averages."    Mauldin
*****************************************************************************

  vcard.vcf
< 1K Download


Sat, 06 Oct 2001 03:00:00 GMT  
 Redim subscript out of range?
Redim can increase only last index -
try to read redim help morte carefully

Quote:

> Hi,


>         rows = 0
>         While ret = CS_SUCCEED Or ret = CS_ROW_FAIL
>             ret = cmd_ptr.vbct_fetch(CS_UNUSED, CS_UNUSED, CS_UNUSED,
> outlen)
>             If ret = CS_SUCCEED Then
>                 If rows = 0 Then
>                     rows = 1
>                 Else
>                     rows = UBound(Tuples, 1)
>                 End If
>                 ReDim Preserve Tuples((rows + 1), 9) '****HERE******
>                 For Col = 1 To ncols.Data
>                     Tuples(rows - 1, Col - 1) = cmd_ptr.vbct_data(Col)
>                 Next Col
>             End If
>         Wend
> Above is code for my SQL Sombrero. What it does is retrieve sybase rows
> line by line. The problem is that if I leave Preserve statement the
> ReDim fails with subscript out of range error. I made sure that I am not
> getting into problem where I am decreasing the subscript. So, that's not
> the problem.
> When I take the Preserve out, then it works.
> Any ideas?

> --
> *****************************************************************************
> S. Hoon Yoon (Quant) Merrill {*filter*} Equity Trading,

> "Miracle is always only few standard deviations away, but so is
> catastrophe."
> * Expressed opinions are often my own, but NOT my employer's.
> "I feel like a fugitive from the law of averages."    Mauldin
> *****************************************************************************

>   ------------------------------------------------------------------------


>   Hoon Yoon

>     Netscape Conference Address
>     Netscape Conference DLS Server
>   Additional Information:
>   Last Name
>   First Name  Hoon Yoon
>   Version     2.1

--



Sat, 06 Oct 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Redim causes Subscript Out of Range (Error 9)

2. Subscript out of range error

3. Subscript Out Of Range

4. Subscript out of range error

5. Subscript out of range error

6. Subscript out of range

7. AddShapeRecordDetected Error: Subscript out of range

8. Defining an array and getting Subscript Out of Range Error

9. array subscript out of range

10. help with subscript out of range error

11. subscript out of range? (floating array problem)

12. Xarray ended up with Subscript out of range in Asian locale

 

 
Powered by phpBB® Forum Software