[AccessD] Random numbers lottery-style

Steve Erbach erbachs at gmail.com
Thu Mar 3 14:03:11 CST 2005


JIm,

I'd forgotten about collections. So, lets say we have a collection like thise:

col(1) = 16
col(2) = 18
col(3) = 27
col(4) = 29
...
col(29) = 147

So we generate a random number from 1 to 29 and zoom in on that index
in the collecition. If the selected number is 4 then I pick col(4) and
then remove that item from the collection for the next go round.

But how, then, do I pick the Nth collection item if the indexes are
non-continguous? Or does the collection re-index itself after removing
an item?

Steve Erbach



On Thu, 3 Mar 2005 14:28:06 -0500, Jim DeMarco
<Jdemarco at hudsonhealthplan.org> wrote:
> Steve,
> 
> Rather than an array how about using the VBA Collection object which will allow you to remove an item.  Add your Activity ID items to a Collection with your numeric value as the key value.
> 
> HTH,
> 
> Jim DeMarco



More information about the AccessD mailing list