How randomly choose a field value in Access to display

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?
 
A

Armen Stein

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
 
K

KARL DEWEY

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;
 

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