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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How randomly choose a field value in Access to display



 
 
Thread Tools Display Modes
  #1  
Old September 28th, 2009, 03:51 PM posted to microsoft.public.access.gettingstarted
Julie in Wisconsin
external usenet poster
 
Posts: 1
Default How randomly choose a field value in Access to display

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?
  #2  
Old September 28th, 2009, 04:11 PM posted to microsoft.public.access.gettingstarted
Armen Stein
external usenet poster
 
Posts: 507
Default How randomly choose a field value in Access to display

On Mon, 28 Sep 2009 07:51:01 -0700, Julie in Wisconsin Julie in
wrote:

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

  #3  
Old September 28th, 2009, 04:15 PM posted to microsoft.public.access.gettingstarted
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default How randomly choose a field value in Access to display

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;

--
Build a little, test a little.


"Julie in Wisconsin" wrote:

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?

 




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 08:29 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.