A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

produce random results in a report



 
 
Thread Tools Display Modes
  #1  
Old December 15th, 2009, 03:12 AM posted to microsoft.public.access.reports
DamselNTX
external usenet poster
 
Posts: 6
Default produce random results in a report

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
  #2  
Old December 15th, 2009, 08:47 AM posted to microsoft.public.access.reports
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default produce random results in a report

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/libr...d2(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 --

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.