T
Tony WONG
The form looks like a questionnaire with 30 questions
When the user change the answer, then the questionnaire re-calculcate the
marks again
Now i add AfterUpdate event to every combo
But it is not professional to duplicate 30 copies similar codes in the code
page.
How can i add an event to apply to all the 3x Combos?
My Access version is 2007
thanks a lot.
****************************
Private Sub ComboQ2D_AfterUpdate()
Dim mark As Variant
If Me![Plan] = "A" Then
mark = DLookup("ScoreA", "Assessment", "Description='" & [ComboQ2D] & "'")
Me![TextQ2S] = mark
Me!Totalmark = Nz([Q1S]) + Nz([Q2S]) + Nz([Q3S]) + Nz([Q4S]) + Nz([Q5S]) +
Nz([Q5nS]) + Nz([Q6S]) + ...
Else
mark = DLookup("ScoreB", "Assessment", "Description='" & [ComboQ2D] & "'")
Me![TextQ2S] = mark
Me!Totalmark = Nz([Q1S]) + Nz([Q2S]) + Nz([Q3S]) + Nz([Q4S]) + Nz([Q5S]) +
Nz([Q5nS]) + Nz([Q6S]) + ...
End If
End Sub
When the user change the answer, then the questionnaire re-calculcate the
marks again
Now i add AfterUpdate event to every combo
But it is not professional to duplicate 30 copies similar codes in the code
page.
How can i add an event to apply to all the 3x Combos?
My Access version is 2007
thanks a lot.
****************************
Private Sub ComboQ2D_AfterUpdate()
Dim mark As Variant
If Me![Plan] = "A" Then
mark = DLookup("ScoreA", "Assessment", "Description='" & [ComboQ2D] & "'")
Me![TextQ2S] = mark
Me!Totalmark = Nz([Q1S]) + Nz([Q2S]) + Nz([Q3S]) + Nz([Q4S]) + Nz([Q5S]) +
Nz([Q5nS]) + Nz([Q6S]) + ...
Else
mark = DLookup("ScoreB", "Assessment", "Description='" & [ComboQ2D] & "'")
Me![TextQ2S] = mark
Me!Totalmark = Nz([Q1S]) + Nz([Q2S]) + Nz([Q3S]) + Nz([Q4S]) + Nz([Q5S]) +
Nz([Q5nS]) + Nz([Q6S]) + ...
End If
End Sub