G
Guest
I want to know if it is possible to nth a list in ACCESS?
like to be able to choose all that meet a certain criteria (sayFrom a dbs containing several thousand records, I would
from the records that meet that criteria, randomly select aone field is equal to, or greater than, zero); and then
sample of say 20.
I can achieve this relatively easily in XL, using formulae and some VBA code.
Can anyone point me towards the right approach for Access?
I want to know if it is possible to nth a list in ACCESS?
-----Original Message-----
I want to know if it is possible to nth a list in ACCESS?
Explicate? I'm not familiar with "nthing"...
You can extract random records though: create a little function by
editing into a Module named basRandom:
Public Function RandNum(vIgnore As Variant) As Double
Static bRandomized As Boolean
If Not bRandomized Then
Randomize ' initialize the random number generator
bRandomized = True
End If
RandNum = Rnd()
End Function
Then in your Query put a calculated field
Shuffle: RandNum([somefield])
where somefield is any field in your table; this will force Access to
call the function for every row.
Sort by this field, and use the TOP VALUES property of the query to
return the top 100, or top 10%, or whatever number of records you
want.
.