I need scoring a form answers with conditional calcualtions?

D

Dimoxi

I need to design a form that when a user selects items from combo box, or
check few checkboxes, the program add the related score to each selection and
option and show it in another field. At the end I need the scores to be
stored as a part of the data with the rest of taht person's information.
 
A

Arvin Meyer [MVP]

The results of a calculation don't usually need to be stored because the
calculation can be repeated at any time. To total the results of your
actions while selecting the items, use the click or afterupdate event of
each item and "push" the data intoa text box, like:

Sub cboWhatever_AfterUpdate()
Me.txtTotal = Me.txtTotal + Me.cboWhatever
End Sub

as you select each contol, simply add its value to the value in txtTotal.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
D

Dimoxi

Thank you very much Arvin Meyer,

The problem with "Click" event is not a good choice because regardless to
the checkbox select or deselct condition it only adds the value to the total
field.
"AfterUpdate" event is also incapable of subtracting the value after
unchecking the box if, the user checked that box by accident.

do you have other solution for this problem?
+Regards
 
A

Arvin Meyer [MVP]

Comboboxes can't be de-selected (except in code), but listboxes can, as can
checkboxes. For that you need a conditional statement:

Sub chkWhatever_Click()
If Me.chkWhatever = True Then
Me.txtTotal = Me.txtTotal + Me.chkWhatever
Else
Me.txtTotal = Me.txtTotal - Me.chkWhatever
End If
End Sub

--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 

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