Sorting fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all, I have a report that I print off questions, but I would like to sort the questions randomly on open, and make sure that they are never in the same order.....can someone help?

Thanks...
 
Assuming you have a numeric primary key named (say) QuestionID, type this
into the Field row of a query:
RandomNum: Rnd([QuestionID])

Sort the query on this field, and your questions will come up in random
order.

Note that you need to issue a Randomize command once in your session for
this to work. You can do that when the database opens, or just go to the
Immediate window (Ctrl+G) and enter:
Randomize

The Rnd() function does not actually do anything with your primary key, but
unless you pass some value in from the query, Access doesn't bother calling
the function so you don't get the random values.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

MC said:
Hi all, I have a report that I print off questions, but I would like to
sort the questions randomly on open, and make sure that they are never in
the same order.....can someone help?
 
Back
Top