From: DamselNTX on
I'm trying to write a report that will produce random results each time it is
run. There are approximately 300 records in my database. For each record, I
have included a field with a number identifier (1-7). Each time I run the
report, I want it to choose records randomly based on the following list (the
number represents the identifier).

2
2
1
7
7
7
5
3
4
6
From: Stefan Hoffmann on
On 15.12.2009 04:12, DamselNTX wrote:
> I'm trying to write a report that will produce random results each time it is
> run. There are approximately 300 records in my database. For each record, I
> have included a field with a number identifier (1-7). Each time I run the
> report, I want it to choose records randomly based on the following list (the
> number represents the identifier).
Use

http://www.mvps.org/access/queries/qry0011.htm

and

http://msdn.microsoft.com/en-us/library/f7s023d2(VS.80).aspx

and instead of a ORDER BY clause use a WHERE like this

WHERE [NumberField] = CInt(Int(Rnd()*7+1))

The important part is to use a Rnd() without a field as parameter, so
that the function will only be executed once.


mfG
--> stefan <--