I have a table of let say 100 questions (text fields) , I need to randomly
choose and display ten questions on a report.
I don't know, I think that's enough.
Thank you
I have a table of let say 100 questions (text fields) , I need to randomly
choose and display ten questions on a report.
I don't know, I think that's enough.
Create a new Module named basRand and paste this little function into it:
Public Function RandNum(vIgnore As Variant) As Double
Static bDone As Boolean
If Not bDone Then
Randomize
bDone = True
End If
RandNum = Rnd()
End Function
Then create a Query based on your table of questions; in a vacant Field cell
type
SortKey: RandNum([QuestionNo])
using any fieldname in your table as an argument - this just forces Access
to call the function for every row instead of "saving time" by calling it
just once.
Sort ascending (or descending, makes no difference) by this field and set
the Query's Top Values property to 10.
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.