Creating score by counting weighted checkboxes?

J

John D. Peterson

I'm trying to develop a scoring system by examining
checkboxes on a dislayed form but the syntax is eluding
me. I've tried vatiations of the following in Default
Value for [Score] using Expression Builder to no avail:

(IF [PBS] = "Yes" THEN 20 ELSE 0) + (IF [BT] = "Yes" THEN
10 ELSE 0) + (IF [MS] = "Yes" THEN 10 ELSE 0)

Where [PBS], [BT] and [MS] are Yes/No Checkboxes and the
expression is in the numeric field [Score]. If all three
checkboxes on the form are checked by the user, the Score
field should reflect a total of 40 and if only [PBS] is
checked the total should be 20.

Also do I need or should I have an event trigger of some
sort (i.e. [PBS].OnGotFocus) reflected in the expression
to cause the score to update as checkboxes are
manipulated by the user?
 
G

Gerald Stanley

Try setting the ControlSource for [Score] to something
along the lines of
= CInt(IIf([PBS],20,0)) + CInt(IIf([BT],10,0)) +
CInt(IIf([MS],10,0))

Hope This Helps
Gerald Stanley MCSD
 
G

Guest

Thanks! It works perfectly.
-----Original Message-----
Try setting the ControlSource for [Score] to something
along the lines of
= CInt(IIf([PBS],20,0)) + CInt(IIf([BT],10,0)) +
CInt(IIf([MS],10,0))

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I'm trying to develop a scoring system by examining
checkboxes on a dislayed form but the syntax is eluding
me. I've tried vatiations of the following in Default
Value for [Score] using Expression Builder to no avail:

(IF [PBS] = "Yes" THEN 20 ELSE 0) + (IF [BT] = "Yes" THEN
10 ELSE 0) + (IF [MS] = "Yes" THEN 10 ELSE 0)

Where [PBS], [BT] and [MS] are Yes/No Checkboxes and the
expression is in the numeric field [Score]. If all three
checkboxes on the form are checked by the user, the Score
field should reflect a total of 40 and if only [PBS] is
checked the total should be 20.

Also do I need or should I have an event trigger of some
sort (i.e. [PBS].OnGotFocus) reflected in the expression
to cause the score to update as checkboxes are
manipulated by the user?
.
.
 

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