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  

Grabbing random records (access 2003)



 
 
Thread Tools Display Modes
  #1  
Old November 29th, 2005, 03:57 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Grabbing random records (access 2003)

Using Access 2003

I would like to randomly grab say 10 records from the table that the report
is based on.

How would I go about this?

TIA,
_Bigred





  #2  
Old November 29th, 2005, 04:52 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Grabbing random records (access 2003)

_Bigred wrote:

Using Access 2003

I would like to randomly grab say 10 records from the table that the report
is based on.



Base the report on a query Like:

SELECT TOP 10 f1,f2,f3,...
FROM table
ORDER BY Rnd(posnumfield)

Be sure to use the Randomize statement before opening the
report.

posnumfieldcan be any field that has a positive value in
every record. If you don't have a field like that, use:
Rnd(Abs(anynumfield) + 1)

--
Marsh
MVP [MS Access]
  #3  
Old November 29th, 2005, 04:52 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Grabbing random records (access 2003)

Create this query as the RecordSource for your report:
SELECT TOP 10 * FROM Table1 ORDER BY Rnd(Table1.ID), Table1.ID;

Note that you need to issue a Randomize so that the sequences don't repeat.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"_Bigred" m wrote in
message
...
Using Access 2003

I would like to randomly grab say 10 records from the table that the
report is based on.

How would I go about this?



 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ambiguous Name Error pm Using Forms 10 June 5th, 2005 09:19 PM
What is the difference between 2002 and 2003? Red Sonya General Discussion 2 March 1st, 2005 05:10 AM
Book recommendations, please Top Spin New Users 2 March 1st, 2005 12:43 AM
Access XP Compared to Access 2003 Mardene Leahu New Users 1 October 1st, 2004 05:11 AM
Access 2003 RK General Discussion 12 June 14th, 2004 10:16 AM


All times are GMT +1. The time now is 07:21 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.