How randomly choose a field value in Access to display

  • Thread starter Thread starter Julie in Wisconsin
  • Start date Start date
J

Julie in Wisconsin

I would like to set up a fairly simple database and as oneof the reports, I'd
like the software to randomly choose from all of the available values in one
specific field and display the record containing that value. Is there a
fairly simple way to do this? I'm not very familiar with programming or
macros but could maybe handle something basic. Otherwise a formula using
date & time or something like that?
 
On Mon, 28 Sep 2009 07:51:01 -0700, Julie in Wisconsin <Julie in
I would like to set up a fairly simple database and as oneof the reports, I'd
like the software to randomly choose from all of the available values in one
specific field and display the record containing that value. Is there a
fairly simple way to do this? I'm not very familiar with programming or
macros but could maybe handle something basic. Otherwise a formula using
date & time or something like that?

Here's an article on selecting random records:

http://blogs.techrepublic.com.com/howdoi/?p=149

It basically involves including a calculated random number column in
your query, then using that column to sort on. You can use TOP 1 to
select the "winner".

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 
Try this using any number field in you table for [PersonID] ---
SELECT TOP 1 YourTable.*, Rnd([PersonID])*1000 AS Expr1
FROM YourTable
ORDER BY Rnd([PersonID])*1000 DESC;
 
Back
Top