Code to display random records in form

T

Teddy

I have a database and these are my tables.

tblReference
ReferenceID
Question

tblAnswer
AnswerID
ReferenceID
Question
GivenAnswer

On my form I have a start button, which I’d like to add a code to, so when
the user clicks it a random record from the Question field of tblReference
will be displayed in the first field of the form; Below that field will be an
empty field to give an answer.

Next to the start button I have a continue button. I’d like to add code to
this button, so when it’s pressed a new record will get created in tblAnswer
that contains the question asked and the answer given.

Finally, I have an Exit button next to the continue button, which I’d like
to add a macro to so when it is pressed the program stops. I’d like to
continue this program (the same question/record can be asked/displayed more
than once) until the user decides to stop the program by clicking an Exit
button on the form. Do you know what code(s) would make this work? Do I
need to change my table design or would what I currently have work?
 
P

PieterLinden via AccessMonster.com

you could use code here to generate a random number and filter your form when
you open it using the number...

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

If you want several random numbers, you could use something like [FieldX] IN
(" and create a comma-delimited list of values and then close the list with a
final ) and then pass that as the filter.
 

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