Random Sample Within Parameters

G

Guest

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.
 
G

Guest

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]);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top