Prev: Report error Run Time error 2427
Next: Problems Summing
From: DamselNTX on 14 Dec 2009 22:12 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 15 Dec 2009 03:47 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 <--
|
Pages: 1 Prev: Report error Run Time error 2427 Next: Problems Summing |