From: xytsrm on
Does anyone know if there is a function that returns the size of a ReDim'ed
single dimension array?

X.

From: dpb on
xytsrm wrote:
> Does anyone know if there is a function that returns the size of a ReDim'ed
> single dimension array?

UBound()

--
From: Tony Toews [MVP] on
xytsrm <xytsrm(a)discussions.microsoft.com> wrote:

>Does anyone know if there is a function that returns the size of a ReDim'ed
>single dimension array?

and LBound in case someone's been mucking with those.

Note however that these are the limits of the number of values in the
array. This isn' the size the array is consuming in bytes.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Granite Fleet Manager http://www.granitefleet.com/
From: MikeD on


"dpb" <none(a)non.net> wrote in message
news:har6dm$cet$1(a)news.eternal-september.org...
> xytsrm wrote:
>> Does anyone know if there is a function that returns the size of a
>> ReDim'ed single dimension array?
>
> UBound()


Not really quite that simple. UBound() by itself only does it if the lower
bound is 1. Since the default lower bound of an array is 0, that's what
most commonly used, so if the upper bound is 10, then there's really 11
elements in the array.

You should use UBound() - LBound + 1

--
Mike


From: xytsrm on
Thanks everyone.

I'm actually just looking for the current index, not the number of bytes, so
UBound should work.

X.


"xytsrm" wrote:

> Does anyone know if there is a function that returns the size of a ReDim'ed
> single dimension array?
>
> X.
>
 |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11
Prev: Array of pointers
Next: Will this object get destroyed?