Results 1 to 2 of 2
2003-04-09, 13:38 #1
- Join Date
- Nov 2002
- Thanked 0 Times in 0 Posts
Update Control Automatically (97)
I have serveral control on a form that have drop down list boxes. After all the controls are updated, I would like to have a count of all the same occurences in the rating section. I created a procedure that counts the occurences, and attached it to the property "ON ENTER" on the "always" field. This procedure is repeated for all the coccurences (always, never, rarely, etc.) See attachment.
Private Sub ctalways_Enter()
Dim sumrate As Integer
If [list] = "always" Then
sumrate = sumrate + 1
ctalways = sumrate * 5
2003-04-09, 13:59 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
Re: Update Control Automatically (97)
To make calculating the total score easy, you should have a table structure like this:
<td>EmployeeID</td><td>QuestionID</td><td>Score</td> <td align=right>80201</td><td align=right>1</td><td align=right>5</td> <td align=right>80201</td><td align=right>2</td><td align=right>5</td> <td align=right>80201</td><td align=right>3</td><td align=right>0</td> <td align=right>80201</td><td align=right>4</td><td align=right>3</td> <td align=right>80201</td><td align=right>5</td><td align=right>1</td></table>
QuestionID is linked to a questions table (1="Listens to the opinions of others", etc.) and Score is linked to a scores table (0="never", ..., 5 = "always").
In this structure, calculating the total score is just adding the individual scores for an employee.
<img src=/w3timages/blueline.gif width=33% height=2>
If this is not feasible, you should still have a scores table, with a numeric field Score and a text field Description. This table would be the Row Source of the combo box. The combo box would have two columns, of which the first would have column width 0. The description would be displayed, but the value of the combo box would be the numeric Score.
To count, define an array
Dim ScoreCount(0 to 5) As Integer
and to count, use
ScoreCount([list]) + 1
Snce Listen is 5 for employee 80201, the above instruction will increase ScoreCount(5) by 1.
At the end, calculate the total score as
0 * ScoreCount(0) + 1 * ScoreCount(1) + ... + 5 * ScoreCount(5)
As you see, much more work than in the structure proposed above, but much less than all those If statements.