Re: Increment a Variable?
- From: "Dirk Goldgar" <dg@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 7 Jul 2005 13:37:34 -0400
"Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5430DB28-D61B-4C29-AA88-E75C38275AF3@xxxxxxxxxxxxx
> No, it does not have to be a Variant type, but you can't change data
> types with a redim unless the array is contained in a Variant.
>
> "Dirk Goldgar" wrote:
>
>> "Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:B8BC07DC-BC5F-4BE6-A2ED-B229075B6C74@xxxxxxxxxxxxx
>>> Or:
>>> Dim MyArray(100) As Variant ' or as a specific type
>>> Dim I As Integer
>>>
>>> Do While <some condition>
>>>
>>> If I >= UBound(MyArray) Then
>>> Redim MyArray(I+1) Preserve
>>> End If
>>> I = I + 1
>>> MyArray(I) = <some value>
>>>
>>> Loop
>>
>> <g> I thought of that, but didn't want to get too deep. I believe,
>> though, that for your version to work, you have to change this:
>>
>>> Dim MyArray(100) As Variant
>>
>> to this:
>>
>> Dim MyArray() As Variant
>>
>> ' ...
>>
>> ReDim MyArray(100) ' maybe a good starting size
>>
>> or just this:
>>
>> ReDim MyArray(100) ' to start with
No, that wasn't my point. My point was that if you declare the array as
non-dynamic (by using Dim with specific bounds), you won't be able to
use ReDim to change the bounds.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.
- Follow-Ups:
- Re: Increment a Variable?
- From: Klatuu
- Re: Increment a Variable?
- References:
- Increment a Variable?
- From: G
- Re: Increment a Variable?
- From: Klatuu
- Re: Increment a Variable?
- From: Dirk Goldgar
- Re: Increment a Variable?
- From: Klatuu
- Increment a Variable?
- Prev by Date: Re: OnCurrent Issue
- Next by Date: Re: Abort inserting a record in a form
- Previous by thread: Re: Increment a Variable?
- Next by thread: Re: Increment a Variable?
- Index(es):
Relevant Pages
|