Kamis, 02 Maret 2017

Re: [MS_AccessPros] randomly chosen groups

 

dyspoz2 - (name?)


You can use the Rnd function to do what you want in a query.

Group:  (Rnd([Household Number]) * 4) Mod 4

That will give you a random number between 0 and 3 to assign your groups.  Add 1 if you want groups 1 through 4.  Use that in an UPDATE query to assign the values.

NOTE:  You WILL get random numbers, but there's no guarantee that an equal number of households will be assigned to each group.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Mar 2, 2017, at 6:34 PM, dyspoz2@cox.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



I would like to divide a table of family households up into 4 randomly chosen groups using an AutoNumber generated field "Household Number".  Then putting that group number into a field in the table   How can I do this?




__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar