G
gsanderson99
I have a form with 12 option groups, each a field in a table. The
table formats each of the fields (Ambulation, Transfer, ADL, etc.) as
a number with a default of 0. The user selects an option, 1, 2, or 3,
via the option group. A command button runs this function:
Private Sub cmdCalculate_Click()
CountLow = 0
CountModerate = 0
CountComplex = 0
CountZero = 0
If Ambulation = 0 Then
CountZero = CountZero + 1
Else
If Ambulation = 1 Then
CountLow = CountLow + 1
Else
If Ambulation = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Transfer = 0 Then
CountZero = CountZero + 1
Else
If Transfer = 1 Then
CountLow = CountLow + 1
Else
If Transfer = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If ADL = 0 Then
CountZero = CountZero + 1
Else
If ADL = 1 Then
CountLow = CountLow + 1
Else
If ADL = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Continence = 0 Then
CountZero = CountZero + 1
Else
If Continence = 1 Then
CountLow = CountLow + 1
Else
If Continence = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Nutrition = 0 Then
CountZero = CountZero + 1
Else
If Nutrition = 1 Then
CountLow = CountLow + 1
Else
If Nutrition = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Orientation = 0 Then
CountZero = CountZero + 1
Else
If Orientation = 1 Then
CountLow = CountLow + 1
Else
If Orientation = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Behavior = 0 Then
CountZero = CountZero + 1
Else
If Behavior = 1 Then
CountLow = CountLow + 1
Else
If Behavior = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If SNF = 0 Then
CountZero = CountZero + 1
Else
If SNF = 1 Then
CountLow = CountLow + 1
Else
If SNF = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Admissions = 0 Then
CountZero = CountZero + 1
Else
If Admissions = 1 Then
CountLow = CountLow + 1
Else
If Admissions = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Evaluations = 0 Then
CountZero = CountZero + 1
Else
If Evaluations = 1 Then
CountLow = CountLow + 1
Else
If Evaluations = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Stability = 0 Then
CountZero = CountZero + 1
Else
If Stability = 1 Then
CountLow = CountLow + 1
Else
If Stability = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Treatment = 0 Then
CountZero = CountZero + 1
Else
If Treatment = 1 Then
CountLow = CountLow + 1
Else
If Treatment = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
'If CountZero = 0 Then
Me!Low_Acuity = CountLow
Me!Moderate_Acuity = CountModerate
Me!Complex_Acuity = CountComplex
Me!Zero_Acuity = CountZero
'Me!cmdCalculate.Visible = False
Me!cmdSave.Visible = True
Me!Tool_Complete = "Yes"
If CountComplex > 6 Then
Total_Acuity = "Complex"
boxComplex.Visible = True
lblComplexTotal.Visible = True
Else
If CountModerate > 4 And CountModerate < 7 Then
Total_Acuity = "Moderate"
boxModerate.Visible = True
lblModerateTotal.Visible = True
Else
Total_Acuity = "Low"
boxLow.Visible = True
lblLowTotal.Visible = True
End If
End If
cmdSave.SetFocus
'Else
'Message = MsgBox("Please fill in all prompts and Calculate
again", vbOKOnly, "Action not complete")
'optAmbulation.SetFocus
'End If
End Sub
I commented out the “If CountZero = 0” in order to determine where the
error is occurring. It is the “Orientation” option group that is not
registering the choice. The result remains the default, 0.
Also, can this be converted to a Select statemet?
Thank you,
Geoff
table formats each of the fields (Ambulation, Transfer, ADL, etc.) as
a number with a default of 0. The user selects an option, 1, 2, or 3,
via the option group. A command button runs this function:
Private Sub cmdCalculate_Click()
CountLow = 0
CountModerate = 0
CountComplex = 0
CountZero = 0
If Ambulation = 0 Then
CountZero = CountZero + 1
Else
If Ambulation = 1 Then
CountLow = CountLow + 1
Else
If Ambulation = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Transfer = 0 Then
CountZero = CountZero + 1
Else
If Transfer = 1 Then
CountLow = CountLow + 1
Else
If Transfer = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If ADL = 0 Then
CountZero = CountZero + 1
Else
If ADL = 1 Then
CountLow = CountLow + 1
Else
If ADL = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Continence = 0 Then
CountZero = CountZero + 1
Else
If Continence = 1 Then
CountLow = CountLow + 1
Else
If Continence = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Nutrition = 0 Then
CountZero = CountZero + 1
Else
If Nutrition = 1 Then
CountLow = CountLow + 1
Else
If Nutrition = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Orientation = 0 Then
CountZero = CountZero + 1
Else
If Orientation = 1 Then
CountLow = CountLow + 1
Else
If Orientation = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Behavior = 0 Then
CountZero = CountZero + 1
Else
If Behavior = 1 Then
CountLow = CountLow + 1
Else
If Behavior = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If SNF = 0 Then
CountZero = CountZero + 1
Else
If SNF = 1 Then
CountLow = CountLow + 1
Else
If SNF = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Admissions = 0 Then
CountZero = CountZero + 1
Else
If Admissions = 1 Then
CountLow = CountLow + 1
Else
If Admissions = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Evaluations = 0 Then
CountZero = CountZero + 1
Else
If Evaluations = 1 Then
CountLow = CountLow + 1
Else
If Evaluations = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Stability = 0 Then
CountZero = CountZero + 1
Else
If Stability = 1 Then
CountLow = CountLow + 1
Else
If Stability = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
If Treatment = 0 Then
CountZero = CountZero + 1
Else
If Treatment = 1 Then
CountLow = CountLow + 1
Else
If Treatment = 2 Then
CountModerate = CountModerate + 1
Else
CountComplex = CountComplex + 1
End If
End If
End If
'If CountZero = 0 Then
Me!Low_Acuity = CountLow
Me!Moderate_Acuity = CountModerate
Me!Complex_Acuity = CountComplex
Me!Zero_Acuity = CountZero
'Me!cmdCalculate.Visible = False
Me!cmdSave.Visible = True
Me!Tool_Complete = "Yes"
If CountComplex > 6 Then
Total_Acuity = "Complex"
boxComplex.Visible = True
lblComplexTotal.Visible = True
Else
If CountModerate > 4 And CountModerate < 7 Then
Total_Acuity = "Moderate"
boxModerate.Visible = True
lblModerateTotal.Visible = True
Else
Total_Acuity = "Low"
boxLow.Visible = True
lblLowTotal.Visible = True
End If
End If
cmdSave.SetFocus
'Else
'Message = MsgBox("Please fill in all prompts and Calculate
again", vbOKOnly, "Action not complete")
'optAmbulation.SetFocus
'End If
End Sub
I commented out the “If CountZero = 0” in order to determine where the
error is occurring. It is the “Orientation” option group that is not
registering the choice. The result remains the default, 0.
Also, can this be converted to a Select statemet?
Thank you,
Geoff