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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Random Sample Within Parameters



 
 
Thread Tools Display Modes
  #1  
Old February 16th, 2007, 07:02 PM posted to microsoft.public.access.queries
Don
external usenet poster
 
Posts: 992
Default Random Sample Within Parameters

Hoping someone can help. I have reviewed many postings on drawing a random
sample and have looked at several web pages, but the postings all assume a
higher Access knowledge level than I have.

I have created a query from a table from which I need to select a sample of
5 [strReviewID] records from a defined time period (one week) and by a
selected employee ID. The query is presently set up as follows:

SELECT tblReview.strReviewID, tblReview.CloseDate, tblReview.ReviewType,
tblReview.strAssigned, tblReview.Probe, tblReview.Targeted,
tblReview.QAReviewer, tblReview.QADate
FROM tblReview
WHERE(((tblReview.CloseDate) Between [Enter begin date] And [end date]) AND
((tblReview.strAssigned)=[Enter Employee ID]));

These fields are either alphanumeric set to text or they are a date. Where
do I place the "Rnd" statement and how should it be set up?

Another point to remember is that I want a maximum of 5 records to review
per employee, but not all employees may have 5 records available.
--
Thanks!
  #2  
Old February 16th, 2007, 07:38 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Random Sample Within Parameters

This will do what you asked --

SELECT TOP 5 tblReview.strReviewID, tblReview.CloseDate,
tblReview.ReviewType, tblReview.strAssigned, tblReview.Probe,
tblReview.Targeted, tblReview.QAReviewer, tblReview.QADate,
Int((([strReviewID]*3.41423456)-Int([strReviewID]*3.41423456))*[Enter a 2
digit number]) AS Rnd
FROM tblReview
WHERE (((tblReview.CloseDate) Between [Enter begin date] And [end date]) AND
((tblReview.strAssigned)=[Enter Employee ID]))
ORDER BY
Int((([strReviewID]*3.41423456)-Int([strReviewID]*3.41423456))*[Enter a 2
digit number]);


"Don" wrote:

Hoping someone can help. I have reviewed many postings on drawing a random
sample and have looked at several web pages, but the postings all assume a
higher Access knowledge level than I have.

I have created a query from a table from which I need to select a sample of
5 [strReviewID] records from a defined time period (one week) and by a
selected employee ID. The query is presently set up as follows:

SELECT tblReview.strReviewID, tblReview.CloseDate, tblReview.ReviewType,
tblReview.strAssigned, tblReview.Probe, tblReview.Targeted,
tblReview.QAReviewer, tblReview.QADate
FROM tblReview
WHERE(((tblReview.CloseDate) Between [Enter begin date] And [end date]) AND
((tblReview.strAssigned)=[Enter Employee ID]));

These fields are either alphanumeric set to text or they are a date. Where
do I place the "Rnd" statement and how should it be set up?

Another point to remember is that I want a maximum of 5 records to review
per employee, but not all employees may have 5 records available.
--
Thanks!

 




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 07:20 PM.


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