show random records

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

Guest

Hi,

I'm using Access 97. I have a form (frmQuest) that is linked to a table
(tblMain) that contains a number of records. (The fields are 'Question',
'Answer' and 'QNo' which is an autonumber field.)

I have set up the form so that only the 'Question' field shows until the
'answer button' is pressed and the answer field disappears when a new
question is shown.

What I would like is a 'random new question' button that would display the
Question field in the same way (ie on the form) - is this possible? I've done
it in a query:

SELECT TOP 1 tblMain.Question
FROM tblMain
ORDER BY Rnd(tblMain.QNo);

but don't know how to show it on the form.

Many thanks
Marie
 
Hi, Marie.

Clever.

Include the answer in your query as well. Then simply set the RecordSource
property of the form in your code:

Me.RecordSource = "qryRand" (If saved)
or
Me.RecordSource = <sql statement enclosed in quotes>
 
Fantastic - thank you.

Marie.

Sprinks said:
Hi, Marie.

Clever.

Include the answer in your query as well. Then simply set the RecordSource
property of the form in your code:

Me.RecordSource = "qryRand" (If saved)
or
Me.RecordSource = <sql statement enclosed in quotes>
 

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

Back
Top