Total of fields calculated by formula on form

N

nilkamals

Hello,

I have an access database that you can input students answers to a
test. A field then determines if this is the correct answer or not
with either a 1 or 0.
Here's the formula:Correct/Wrong1 =IIf([Student Answer
1]="a","1","0") . It is inputted in the control source of a text box.
The formula produces the correct answer and I have this for 25 fields
(the test has 25 questions). Now I would like to add all the 1s and 0s
so I can get a total score.

I made a new text box with the formula = Correct/Wrong1 + Correct/
Wrong2 +...Correct/Wrong25. However, the formula produces a result
like 111100101...10. instead of 24 or whatever the number of 1s adds
up to.

Please let me know how I can fix this.

Thank you so much.
 
A

Al Campagna

Avoid slashes in object names. It may get interpreted as a divide in
some cases.
Use CorrectWrong... not CorrectWrong... or even better, make life easier
with A1, A2, A3... A25 (not so much fingerboning required.

Your IFF statement is returning a Text value.
You're concatenating, rather than summing.
Try returming a number...
A1 = IIf([Student Answer1]="a",1, 0)
A2 = IIf([Student Answer2]="c",1, 0)
etc...
Then, you're sum...
=A1 + A2 + A3 ... A25
should work.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
N

nilkamals

I thought the problem was much greater, but taking the quotation marks
out worked. Thanks a lot for the feedback! I will also take your
advice on changing the name to something I could more easily type out
to avoid having to copy and paste.

thanks again!
 

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