Hi,
The algorithm is like this: read a value, X(i), that is a "bucket"
number. We just have to increase the actual "count" in that bucket by one:
Result( X(i) ) = Result( X(i) ) + 1
and if the bucket does not exist in your collection ( X(i) > larger bucket
number we got), we "add" it with the Redim Preserve (Preserve is required
to keep the "count" in the existing buckets).
In the end, Result( j ) got the number of time we have read a value
in X() that was equal to j.
VB6/VBA6 allow array assignment if the left array is redim-able:
Dim z(1 to 6 ) As Long
Dim a( ) As Long
z(1)=4
z(2)=5
...
a=z ' the copy occur here
If you have to put back each values in a control ( a control belong to a
form, a field belong to a table), it may be preferable to start with a table
and to use the method suggested by Bas Cost Budde, and to display the result
in a continuous form (or sub-form).
Hoping it may help,
Vanderghast, Access MVP