Re: Increment a Variable?



Sorry, Dirk, I misunderstood. You are correct.

"Dirk Goldgar" wrote:

> "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)
>
>
>
.



Relevant Pages

  • Re: Comparing a variant string with char*
    ... I understand what you are saying, but the above code compiles and runs ... A VARIANT type is not a string, and is not comparable to a string; ... There is no VARIANT type that can represent a char string, for example, although there is ...
    (microsoft.public.vc.mfc)
  • Re: Testing for Nulls fails
    ... Apologies to all - I had not set the type to variant for one variable! ... >> Dosomething Else ... > post the real code, the error message and number, and the calling code ... > Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.modulesdaovba)
  • Re: Invalid variant type conversion
    ... >> If there was no variant type, one would probably create one for ... who definately serve a purpose when you want to ... One may discuss the possible problem with coding with variants vs. the ... simple variant assignment may include 100's of instructions. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Using the $ after functions
    ... AnyString = "Hello World" ' Define string. ... I would not need to use the variant that defined how many characters from ... for query expressions - I suggest to use variant type ...
    (microsoft.public.access.modulesdaovba)
  • Com variant
    ... I'm calling a COM function on an IUnknown interface that returns a variant ... int ReadProperty(string PropName, out object PropValue); ... saying that it cannot marshal the variant type. ...
    (microsoft.public.dotnet.framework.interop)