Generate random number(s)

S

steve goodrich

I would like to be able to randomly select records from my table using a
query if possible

I have a table with staff records and would like the user to click a
button, be prompted for "how many staff would you like to select"
and have the query run (maybe a report)

My table is called 'Security Database'
I would like to use the following fields in the query

ID
FIRST NAME
SURNAME
DEPT
The ID field is a number. the rest are text

I am using Access 97

If it is not possible to be prompted for the number of staff I would like
to select - Could a number be defined - say 5

So every time the button is clicked I get a list of 5 random records which
would be different every time.

Hope this make sense.

Any help would be greatly appreciated.
 
S

steve goodrich

I don't think I have explained it as clear as I could have. When I say
random numbers I mean a random number that is already in the ID field and
not just any number.
My ID numbers go from 1 to 1285 and never change
 
P

PieterLinden via AccessMonster.com

steve said:
I don't think I have explained it as clear as I could have. When I say
random numbers I mean a random number that is already in the ID field and
not just any number.
My ID numbers go from 1 to 1285 and never change
I would like to be able to randomly select records from my table using a
query if possible
[quoted text clipped - 23 lines]
Any help would be greatly appreciated.


Steve,
this should work
http://www.mvps.org/access/queries/qry0011.htm
 
S

steve goodrich

Thanks for the reply.
I created the module and saved it as the default 'module1'
I am new to access and I don't understand the second part of the answer.
could you please explain in a little more detail please
many thanks
Steve
PieterLinden via AccessMonster.com said:
steve said:
I don't think I have explained it as clear as I could have. When I say
random numbers I mean a random number that is already in the ID field and
not just any number.
My ID numbers go from 1 to 1285 and never change
I would like to be able to randomly select records from my table using a
query if possible
[quoted text clipped - 23 lines]
Any help would be greatly appreciated.


Steve,
this should work
http://www.mvps.org/access/queries/qry0011.htm
 

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