Generating a random list of names

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to generate a random list of names from an Access 2000 database.
Using a table that includes the employees' names, I am trying to find a way
to tell the program to identify every 10th (or whatever value) record, or
something similar, so that the list would be randomly generated.

Any ideas on how to accomplish this would be greatly appreciated.

Thanks
 
Hi, Kristie.

Please see an example of this in a KB article on the following Web page:

http://support.microsoft.com/default.aspx?id=208855

A different list is retrieved every time the query runs. If the same sample
list needs to be repeated for testing purposes, one may use an Autonumber
field with the modulus function to retrieve every Nth record.

For example:

SELECT DISTINCT EMPS.LName
FROM EMPS
WHERE (EMPS.ID MOD 10 = 0);

where "ID" is the autonumer field and LName is the "last name" field. This
will retrieve the 10th, 20th, 30th, etc. record for the LName field, but
won't list duplicate last names if they appear more than once in the table.
To retrieve the 11th, 21st, 31st record, etc, alter the "Where" clause to:

EMPS.ID MOD 10 = 1

Obviously, one gets the same sample list every time this query is run.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question, please sign in to Microsoft's
Online Community and mark these posts, so that all may benefit by filtering
 
Back
Top