Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a test with multiple choice answers

Status
Not open for further replies.

debbie1212

Programmer
May 31, 2000
66
US
I have a test I am wanting to create in VB using an Access database. I want it to have multiple choice answers. I'm assuming I need to use an autonumber primary key on the table with the questions and foreign keys on the table with the answers. How would I associate the question to the correct answer in the answer table?

I hope this makes sense. I'm still learning all of this.

Any help would be appreciated.

 
In the question table, have a foreign key link to the correct answer from the answer table. This will create a recursive join between the question table and itself via the answer table, but this is ok as you will only be able to have a link to one answer. NOTE: you will have to define the answers before you can go back and add the correct one to the question table.
 
Thank you for your response.

But I will also have to link the incorrect answers because they still have to be associated with the question.

Also, is it best to use a form to submit the questions and answers so that they get associated with each other without having to keep track and entering them directly into the database?

 
If you follow my structure you will link all possible answers to each question, you will also be able to link only the one possible correct answer back to each question. Yes, you should always use forms for entering/editing/viewing data. Never use the raw tables for this purpose (this is especially true for your users, never allow users direct access to the tables).
 
Thank you so much for your response. I will give it a try.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top