Prev: Array of pointers
Next: Will this object get destroyed?
From: xytsrm on 10 Oct 2009 19:20 Does anyone know if there is a function that returns the size of a ReDim'ed single dimension array? X.
From: dpb on 10 Oct 2009 19:42 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 11 Oct 2009 00:33 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 11 Oct 2009 09:02 "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 11 Oct 2009 09:51
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. > |