Random Selection by Group

M

Micki

Hello, all. I have the following key fields in a table called Line Welds
Lot
WeldNo

I also have a table Lot Status with a yes/no field [Closed]

I need to group any Lots NOT closed and then randomly select one WeldNo per
group.

Can anyone help? Thanks in advance . . .
 
P

Piet Linden

Hello, all.  I have the following key fields in a table called Line Welds
   Lot
   WeldNo

I also have a table Lot Status with a yes/no field [Closed]

I need to group any Lots NOT closed and then randomly select one WeldNo per
group.

Can anyone help?  Thanks in advance . . .

start here:
http://www.mvps.org/access/queries/qry0011.htm

Then just select the top value or whatever of the random number column
per group.
 
M

Micki

I saw that, but it just confused me. I ended up using an auto id in my
table, and inserting a random number creator off of that auto id into the
query that writes to the table. Then I saved my table sorted by the random
number. Finally, I created a query that groups the lots & takes the first of
the random numbers. I won't get a new random selection everytime I run the
query, but at least I have "predestined" some records to be randomly chossen.

Piet Linden said:
Hello, all. I have the following key fields in a table called Line Welds
Lot
WeldNo

I also have a table Lot Status with a yes/no field [Closed]

I need to group any Lots NOT closed and then randomly select one WeldNo per
group.

Can anyone help? Thanks in advance . . .

start here:
http://www.mvps.org/access/queries/qry0011.htm

Then just select the top value or whatever of the random number column
per group.
 
J

Jackson, Lucas

What does this do?


I saw that, but it just confused me. I ended up using an auto id in my
table, and inserting a random number creator off of that auto id into the
query that writes to the table. Then I saved my table sorted by the random
number. Finally, I created a query that groups the lots & takes the first of
the random numbers. I won't get a new random selection everytime I run the
query, but at least I have "predestined" some records to be randomly chossen.

Piet Linden said:
Hello, all. I have the following key fields in a table called Line Welds
Lot
WeldNo

I also have a table Lot Status with a yes/no field [Closed]

I need to group any Lots NOT closed and then randomly select one WeldNo per
group.

Can anyone help? Thanks in advance . . .

start here:
http://www.mvps.org/access/queries/qry0011.htm

Then just select the top value or whatever of the random number column
per group.
 
M

Micki

It ensures that a different "count" of each group gets selected. I might get
the 8th record of group one & the 16th of group two. Each new record has the
opportunity of being the next random sampling in its group because it may be
assigned a random number greater than the last greatest random number in the
group.

Jackson said:
What does this do?


I saw that, but it just confused me. I ended up using an auto id in my
table, and inserting a random number creator off of that auto id into the
query that writes to the table. Then I saved my table sorted by the random
number. Finally, I created a query that groups the lots & takes the first of
the random numbers. I won't get a new random selection everytime I run the
query, but at least I have "predestined" some records to be randomly chossen.

Piet Linden said:
Hello, all. I have the following key fields in a table called Line Welds
Lot
WeldNo

I also have a table Lot Status with a yes/no field [Closed]

I need to group any Lots NOT closed and then randomly select one WeldNo per
group.

Can anyone help? Thanks in advance . . .

start here:
http://www.mvps.org/access/queries/qry0011.htm

Then just select the top value or whatever of the random number column
per group.
 

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

Similar Threads

Access Validation rule in MS access 2010 1
Random Selection 17
Random Function for Selecting Records 3
random selection 2
Random Assignment 2
Random Selection of Records 5
Confused.... Make Table 3
Access Dcount (multiple criteria) 3

Top