How to create a quiz in access? (1 Viewer)

Declan

Registered User.
Local time
Today, 23:26
Joined
Jan 17, 2016
Messages
38
What you need to do is create a table for your questions, just two Fields, basically it will be an ID field "QuestionID" and a text field "QuestionText". Next you need to create the "answers table". Now the answers table is going to drive a subform on a main form so it has to have a particular structure. Call it "tblAnswer" and give it 5 fields:- AnswerID (long), QuestionID (Long), AnswerText (Short Text), AnswerIsCorrect (Boolean), AnswerAnswer (Boolean). Now create a form based on the question table this should just show two Fields. Next, create a form based on the answers table, and have this answers form in datasheet view. Drag the answers form on to the question form and they will link themselves together. You should now have the essence of what you want however there's a lot more to do yet!

Boolean? That isn't an option here. I'm using Access 2016, if that helps.

I shall start working on everything else now.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:26
Joined
Jul 9, 2003
Messages
16,282
Boolean is the programing term for Yes/No
 

Declan

Registered User.
Local time
Today, 23:26
Joined
Jan 17, 2016
Messages
38
Thank you. And when you say 'Long', are you reffering to Long Text, regarding AnswerID and QuestionID's datatypes?

In tblQuestion, QuestionID was automatically set to autonumber, hence the ID. The same is for my AnswerID within tblAnswer. Do all of these need to be set to autonumber or long text? And I assume questionID in tblAnswer will be exactly the same as whatever questionID is in tblQuestion, being a foreign key?
 

Declan

Registered User.
Local time
Today, 23:26
Joined
Jan 17, 2016
Messages
38
The answers form, is that showing all fields?

I created both forms using form wizard, basing it off the tables. What do you mean datasheet view? I can put the original answers table in datasheet view, but not the form. The tbl_answers based form had only viewing options of 'form','layout' and 'design'.

When you say drag, what do you mean? I've tried literally clicking and holding the forms on the 'all acess objects' sidebar to ontop of the other, but it doesn't do anything. I've tried dragging the 'tab' that seperates each item open on the database, but again, to no avail.

(sorry for the huge number of questions!)
 

Declan

Registered User.
Local time
Today, 23:26
Joined
Jan 17, 2016
Messages
38
Ah.. There's autonumber or number. It's fieldsize allows me to choose long integer. It only allows one autonumber field per table however, so I've had to put questionID as number within tbl_Questions. Is that okay? Or..?

The answers form, is that showing all fields?

I created both forms using form wizard, basing it off the tables. What do you mean datasheet view? I can put the original answers table in datasheet view, but not the form. The tbl_answers based form had only viewing options of 'form','layout' and 'design'.

When you say drag, what do you mean? I've tried literally clicking and holding the forms on the 'all acess objects' sidebar to ontop of the other, but it doesn't do anything. I've tried dragging the 'tab' that seperates each item open on the database, but again, to no avail.

(sorry for the huge number of questions!)
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:26
Joined
Jul 9, 2003
Messages
16,282
Yes all the ID fields will need to be Auto number and have a unique index on them.
 

Declan

Registered User.
Local time
Today, 23:26
Joined
Jan 17, 2016
Messages
38
Thank you for your video, that explained it well, aha. (Probably gonna sound creepy, but your voice is really nice to listen to. :D)

Okay. The answers form is now on the main questions form. How do I do from there?

I can't put questionsID within tblAnswers as a Autonumber, it says I can only have one per table. Would it work if I made a relationship between the questionsID in tblquestions and questionsID in tblanswers?


P.S.
Sorry for late reply in doing this, I'm back for the count now!
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:26
Joined
Jul 9, 2003
Messages
16,282
If you have two fields in the tables with the same names, and both Fields are long integer Fields, then they will connect automatically when you drag one form on top of the other.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:26
Joined
Jul 9, 2003
Messages
16,282
Thank you for your video, that explained it well, aha. (Probably gonna sound creepy, but your voice is really nice to listen to. :D)

That was a terrible recording... Couldn't you hear the humming? I had a crap mic at the time, it took me a long time to find a decent mic, without spending hundreds of pounds!
 

Declan

Registered User.
Local time
Today, 23:26
Joined
Jan 17, 2016
Messages
38
Very well.

What should I go about doing next?
 

Declan

Registered User.
Local time
Today, 23:26
Joined
Jan 17, 2016
Messages
38
Oh, is there a way to check they're connected?

And eh, I could but that wasn't tooo bad. :D
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:26
Joined
Jul 9, 2003
Messages
16,282
I'm not sure what you mean? They should be connected, it should be obvious... you should be able to enter data in the subform, move to a new record enter more data, go back to the records...
 

Declan

Registered User.
Local time
Today, 23:26
Joined
Jan 17, 2016
Messages
38
I just wanted to make sure is all, if something can go wrong, it will.

Don't worry. So how should I go from here?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 23:26
Joined
Jul 9, 2003
Messages
16,282
So how should I go from here?

You should enter some questions and some answers. Then, in the boolean field named "AnswerIsCorrect" where the answer is the correct one, add a check Mark. You will need to hide this field from the user, but don't hide it yet, because you need to see it, just imagine that it's invisible.

Now the user will Mark what they consider the correct answer in the next boolean column "AnswerAnswer". I suggest you pretend you are a student and answer some questions so you've got some data to play with.

Next, you need to look at creating a query which Returns those two boolean Fields and then add a field to the query (use the expression builder) build an immediate if (IIf) statement to compare the two Fields. You want the column to show true or yes or "Hurray" if the student has got the answer right, that way you will be able to count how many answers are correct. You will also need to write some code to count how many questions there are so that you can compare the correct answers and the incorrect answers and work out the percentage for your diploma.
 

Declan

Registered User.
Local time
Today, 23:26
Joined
Jan 17, 2016
Messages
38
I have no clue on coding or queries.. Do you recommend any sites or know of anything that can help? :/
 

Users who are viewing this thread

Top Bottom