Simple Math Test

  • Thread starter Thread starter Rick B
  • Start date Start date
R

Rick B

I need to create a simple math test with 30 questions. They should all be
addition. Basically, I need a report with about 6 fields per line. The
first field will be the question number and will start at 1 and go to 30.
The second field will be a random number from 1 to 20. The third field will
be a text box to simply print "+". The fourth field will again be a random
number from 1 to 20. The fifth field will be "=" and the final will just be
an underscore for the answer.

I need to know a few things...

How do I create the question number field, set it to increment by one each
line, and tell it to stop when it gets to 30?
How do I create the random number fields?


I am pretty good with vba and have created random numbers before, so I think
I can probably dig around and find that code.

This will be a printed report that my wife will produce about 10 copies of
each week for her special needs students. I will put a report header to
allow the student to fill in their name and the date. As they progress, I
might expand the numbers and throw in subtraction.

Thanks for your help.
 
Rick B said:
I need to create a simple math test with 30 questions. They should all be
addition. Basically, I need a report with about 6 fields per line. The
first field will be the question number and will start at 1 and go to 30.
The second field will be a random number from 1 to 20. The third field will
be a text box to simply print "+". The fourth field will again be a random
number from 1 to 20. The fifth field will be "=" and the final will just be
an underscore for the answer.

I need to know a few things...

How do I create the question number field, set it to increment by one each
line, and tell it to stop when it gets to 30?
How do I create the random number fields?


I am pretty good with vba and have created random numbers before, so I think
I can probably dig around and find that code.

This will be a printed report that my wife will produce about 10 copies of
each week for her special needs students. I will put a report header to
allow the student to fill in their name and the date. As they progress, I
might expand the numbers and throw in subtraction.

Thanks for your help.
If you are not using Access to track results, then Excel might be a simpler
solution. Install the Analysis TooPack and use the RANDBETWEEN function to
generate your random numbers. Question number is just 1 through 30. You can
use the header in page setup or just the top row(s) to do a Name, Date.

Roxie Aho
roxiea at usinternet.com
 
Okay, some complexity has been added. She DOES want subtraction and
addition. How can I make it randomly do Addition or Subtraction? ALSO,
they are second graders, so the first number must be larger than the second
numbers in a subtraction problem.

Rick B
 
Thanks. That is a great idea, but I don't have the analysis toolpack and
can't install any additional features on my pc.

I think that she wanted to build this report in Access so it can be part of
her other teaching tools in an Access database. Even though it will not
store the results (currently) she wanted to just have it all in one place.

Thanks for the help!!

Rick B
 
Rick B said:
I need to create a simple math test with 30 questions. They should all be
addition. Basically, I need a report with about 6 fields per line. The
first field will be the question number and will start at 1 and go to 30.
The second field will be a random number from 1 to 20. The third field will
be a text box to simply print "+". The fourth field will again be a random
number from 1 to 20. The fifth field will be "=" and the final will just be
an underscore for the answer.

I need to know a few things...

How do I create the question number field, set it to increment by one each
line, and tell it to stop when it gets to 30?
How do I create the random number fields?


I am pretty good with vba and have created random numbers before, so I think
I can probably dig around and find that code.

This will be a printed report that my wife will produce about 10 copies of
each week for her special needs students. I will put a report header to
allow the student to fill in their name and the date. As they progress, I
might expand the numbers and throw in subtraction.

Thanks for your help.

If you are not using Access to complete and track the tests, then Excel may
be a simpler solution. Use the RANDBETWEEN function (requires Analysis
ToolPack) to generate the numbers. Use the header in page setup or top rows
for Name and Date.

The sheet will change each time. Actually will change each time the cell is
recalculated but that shouldn't be a problem. Just print the 10 or so copies.

You can format it fairly easily. You also might want to look at traditional
presentation of
1
+11

Roxie Aho
roxiea at usinternet.com
 
Oooh. Good point on the format. That will be nice for carying numbers! I
will use that in whichever solution I end up with. Thanks!!!

Rick B
 
Here's one way -- just for adding. It's a bit cluttered but I am thinking of
setting up adding and subtraction on one page.

Make a table with four fields, all long integer, no default.
QuestionNumber
FirstNumber
SecondNumber
Type (1 for addition, 2 for subtraction. Not used now but maybe later)

Fill in 30 records with only the question number.

Use the wizard to do a tabular report based on this table.

In Design View on the report, Data tab, change the Control Source for
FirstNumber to =Int((20-0+1)*Rnd()+0). Change SecondNumber to
=Int((20-0+1)*Rnd()+0). Delete the Type field and label.

Format the report to your liking.

For addition/subtractionI think we have to use Recordsets make the table or
update the 30 records with random numbers for FirstNumber, SecondNumber and
Type each time you want a new quiz.

Good luck.
Roxie Aho
roxiea at usinternet.com
 
Rick B said:
Okay, some complexity has been added. She DOES want subtraction and
addition. How can I make it randomly do Addition or Subtraction? ALSO,
they are second graders, so the first number must be larger than the second
numbers in a subtraction problem.

Rick B
<snip>

You might try this.
Table Numbers
QuestionNumber, Long integer, primary key
FirstNumber. long
SecondNumber, long
Type, long
Sign, text, 1

Form with command button to preview the math quiz

Code behind the command button
Option Compare Database

Private Sub Command0_Click()
Dim cnConn As ADODB.Connection
Dim rsNumbers As ADODB.Recordset
Dim strConn As String
Dim strSQL As String
Dim a As Long
Dim b As Long
Dim z As Long
Dim c As Long
Randomize

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=G:\Access\MathQuiz.mdb;Persist Security Info=False"
strSQL = "Select * from tblNumbers"

Set cnConn = New ADODB.Connection
Set rsNumbers = New ADODB.Recordset
cnConn.Open strConn
rsNumbers.Open strSQL, strConn, adOpenDynamic, adLockOptimistic


Do While Not rsNumbers.EOF
z = Int((2 - 1 + 1) * Rnd() + 1)
a = Int((20 - 0 + 1) * Rnd() + 0)
b = Int((20 - 0 + 1) * Rnd() + 0)

rsNumbers(3) = z
If z = 2 And a >= b Then
rsNumbers(1) = a
rsNumbers(2) = b
Else
rsNumbers(2) = a
rsNumbers(1) = b
End If

If z = 1 Then
rsNumbers(4) = "+"
Else
rsNumbers(4) = "-"
End If


'Debug.Print z, rsNumbers(3)

rsNumbers.MoveNext
Loop

rsNumbers.Close
cnConn.Close
Set rsNumbers = Nothing
Set cnConn = Nothing

Dim stDocName As String

stDocName = "rptAdd-Subtract"
DoCmd.OpenReport stDocName, acPreview

End Sub

Base tabular report on table, format to your liking

Roxie Aho
roxiea at usinternet.com
 
Back
Top