G
Guest
On my form I have two combo boxes with value lists ([Impact] and
[Probability]). Based on the combined selection of the combo boxes there is a
specific output in a text box. Due to the multiple possible combinations I
used the following Function (see below). The function was working fine and
would give an automatic update once the selection was made in both combo
boxes. However, it will now only update if I go to a new record or toggle
between the design and form view. Any suggestions?
Function GetResult(Impact As String, Probability As String) As String
Dim strResult As String
Select Case Impact
Case "1- Low"
Select Case Probability
Case "1- Not Probable (0-10%)"
strResult = "GREEN"
Case "2- Low (11-25%)"
strResult = "GREEN"
Case "3- Medium (26-50%)"
strResult = "GREEN"
Case "4- High (51-75%)"
strResult = "GREEN"
Case "5- Nearly Certain (76-100%)"
strResult = "GREEN"
Case Else
strResult = "**ERROR**: Unknown Probability " & Probability
End Select
Case "2- Minor"
Select Case Probability
Case "1- Not Probable (0-10%)"
strResult = "GREEN"
Case "2- Low (11-25%)"
strResult = "GREEN"
Case "3- Medium (26-50%)"
strResult = "YELLOW"
Case "4- High (51-75%)"
strResult = "YELLOW"
Case "5- Nearly Certain (76-100%)"
strResult = "YELLOW"
Case Else
strResult = "**ERROR**: Unknown Probability " & Probability
End Select
Case "3- Moderate"
Select Case Probability
Case "1- Not Probable (0-10%)"
strResult = "GREEN"
Case "2- Low (11-25%)"
strResult = "GREEN"
Case "3- Medium (26-50%)"
strResult = "YELLOW"
Case "4- High (51-75%)"
strResult = "YELLOW"
Case "5- Nearly Certain (76-100%)"
strResult = "RED"
Case Else
strResult = "**ERROR**: Unknown Probability " & Probability
End Select
Case "4- Significant"
Select Case Probability
Case "1- Not Probable (0-10%)"
strResult = "GREEN"
Case "2- Low (11-25%)"
strResult = "YELLOW"
Case "3- Medium (26-50%)"
strResult = "YELLOW"
Case "4- High (51-75%)"
strResult = "RED"
Case "5- Nearly Certain (76-100%)"
strResult = "RED"
Case Else
strResult = "**ERROR**: Unknown Probability " & Probability
End Select
Case "5- High"
Select Case Probability
Case "1- Not Probable (0-10%)"
strResult = "YELLOW"
Case "2- Low (11-25%)"
strResult = "YELLOW"
Case "3- Medium (26-50%)"
strResult = "RED"
Case "4- High (51-75%)"
strResult = "RED"
Case "5- Nearly Certain (76-100%)"
strResult = "RED"
Case Else
strResult = "**ERROR**: Unknown Probability " & Probability
End Select
Case Else
strResult = "**ERROR**: Unknown Impact " & Impact
End Select
GetResult = strResult
End Function
[Probability]). Based on the combined selection of the combo boxes there is a
specific output in a text box. Due to the multiple possible combinations I
used the following Function (see below). The function was working fine and
would give an automatic update once the selection was made in both combo
boxes. However, it will now only update if I go to a new record or toggle
between the design and form view. Any suggestions?
Function GetResult(Impact As String, Probability As String) As String
Dim strResult As String
Select Case Impact
Case "1- Low"
Select Case Probability
Case "1- Not Probable (0-10%)"
strResult = "GREEN"
Case "2- Low (11-25%)"
strResult = "GREEN"
Case "3- Medium (26-50%)"
strResult = "GREEN"
Case "4- High (51-75%)"
strResult = "GREEN"
Case "5- Nearly Certain (76-100%)"
strResult = "GREEN"
Case Else
strResult = "**ERROR**: Unknown Probability " & Probability
End Select
Case "2- Minor"
Select Case Probability
Case "1- Not Probable (0-10%)"
strResult = "GREEN"
Case "2- Low (11-25%)"
strResult = "GREEN"
Case "3- Medium (26-50%)"
strResult = "YELLOW"
Case "4- High (51-75%)"
strResult = "YELLOW"
Case "5- Nearly Certain (76-100%)"
strResult = "YELLOW"
Case Else
strResult = "**ERROR**: Unknown Probability " & Probability
End Select
Case "3- Moderate"
Select Case Probability
Case "1- Not Probable (0-10%)"
strResult = "GREEN"
Case "2- Low (11-25%)"
strResult = "GREEN"
Case "3- Medium (26-50%)"
strResult = "YELLOW"
Case "4- High (51-75%)"
strResult = "YELLOW"
Case "5- Nearly Certain (76-100%)"
strResult = "RED"
Case Else
strResult = "**ERROR**: Unknown Probability " & Probability
End Select
Case "4- Significant"
Select Case Probability
Case "1- Not Probable (0-10%)"
strResult = "GREEN"
Case "2- Low (11-25%)"
strResult = "YELLOW"
Case "3- Medium (26-50%)"
strResult = "YELLOW"
Case "4- High (51-75%)"
strResult = "RED"
Case "5- Nearly Certain (76-100%)"
strResult = "RED"
Case Else
strResult = "**ERROR**: Unknown Probability " & Probability
End Select
Case "5- High"
Select Case Probability
Case "1- Not Probable (0-10%)"
strResult = "YELLOW"
Case "2- Low (11-25%)"
strResult = "YELLOW"
Case "3- Medium (26-50%)"
strResult = "RED"
Case "4- High (51-75%)"
strResult = "RED"
Case "5- Nearly Certain (76-100%)"
strResult = "RED"
Case Else
strResult = "**ERROR**: Unknown Probability " & Probability
End Select
Case Else
strResult = "**ERROR**: Unknown Impact " & Impact
End Select
GetResult = strResult
End Function