C
Carrie
Hello There, I have four Combo Boxes that all work together.
Risk_Level
Risk_Type
Downhole_Option
Inspection_Frequency
The Risk_Level can be Low, Medium or High. Based on that selection, the
Risk_Type allows the appropriate drop down options, as does the
Downhole_Option.
Once those are selected, the Inspection_Frequency calculates the correct
number of years.
All the Risk_Types are stored correctly in the table but on the form they do
not all display. If I scroll through the records, it seems that whatever the
last Risk_Level selected was (ie. Low) in an entry, the Risk_Types will
display for that level only. The Risk_Types for the other 2 Risk_Levels do
not display. Can someone tell me what I'm doing wrong?
Private Sub Action_AfterUpdate()
Call RecalcInspectionFrequency
End Sub
----------------------
Private Sub Downhole_Option_AfterUpdate()
Call RecalcInspectionFrequency
End Sub
----------------------
Private Sub Risk_Type_AfterUpdate()
Call RecalcInspectionFrequency
End Sub
----------------------
Private Sub RiskLevel_AfterUpdate()
Call RecalcInspectionFrequency
Me.Risk_Type.Requery
Me.Downhole_Option.Requery
End Sub
Private Sub RecalcInspectionFrequency()
If (Me!Action = 3) Then ' 3 is Suspend
Select Case Me!RiskLevel
Case "1" ' 1 is Low
If Me!Risk_Type = 1 Then ' 1 is Type 1 Noncritical sour cased
well (no perfs)
Me!Inspection_Frequency = 5 ' Inspect every 5 years
ElseIf Me!Risk_Type = 2 Then ' 2 is Type 2 Gas well < 28,000
m3/d that is low risk
Me!Inspection_Frequency = 5 ' Inspect every 5 years
ElseIf Me!Risk_Type = 3 Then ' 3 is Type 3 Water source well
Me!Inspection_Frequency = 5 ' Inspect every 5 years
ElseIf Me!Risk_Type = 4 Then ' 4 is Type 4 Class 4 injector
Me!Inspection_Frequency = 5 ' Inspect every 5 years
Else: Me!Inspection_Frequency = 1 ' This would be for Type 5
Nonflowing oil wells < 50 mol/kmol H2S Content
End If
Case "2" ' 2 is Medium
If Me!Downhole_Option = 6 Then ' 6 is Option "1" Packer & Tubing
Plug
Me!Inspection_Frequency = 3 ' Inspect every 3 years
Else: Me!Inspection_Frequency = 5 ' This would be for 7 & 8
which is for Option "2" Bridge Plug and Option "3" Cavern Svc Wells
End If
Case "3" ' 3 is High
If Me!Downhole_Option = 9 Then ' 9 is Option "1" Packer & Tubing
Plug
Me!Inspection_Frequency = 1 ' Inspect every year
Else: Me!Inspection_Frequency = 5 ' This would be for 10 which
is Option "2" Bridge Plug capped w/ 8m lineal cement
End If
Case Else
Me!Inspection_Frequency = 0
End Select
End If ' test "Suspend
End Sub
Thanks!
Risk_Level
Risk_Type
Downhole_Option
Inspection_Frequency
The Risk_Level can be Low, Medium or High. Based on that selection, the
Risk_Type allows the appropriate drop down options, as does the
Downhole_Option.
Once those are selected, the Inspection_Frequency calculates the correct
number of years.
All the Risk_Types are stored correctly in the table but on the form they do
not all display. If I scroll through the records, it seems that whatever the
last Risk_Level selected was (ie. Low) in an entry, the Risk_Types will
display for that level only. The Risk_Types for the other 2 Risk_Levels do
not display. Can someone tell me what I'm doing wrong?
Private Sub Action_AfterUpdate()
Call RecalcInspectionFrequency
End Sub
----------------------
Private Sub Downhole_Option_AfterUpdate()
Call RecalcInspectionFrequency
End Sub
----------------------
Private Sub Risk_Type_AfterUpdate()
Call RecalcInspectionFrequency
End Sub
----------------------
Private Sub RiskLevel_AfterUpdate()
Call RecalcInspectionFrequency
Me.Risk_Type.Requery
Me.Downhole_Option.Requery
End Sub
Private Sub RecalcInspectionFrequency()
If (Me!Action = 3) Then ' 3 is Suspend
Select Case Me!RiskLevel
Case "1" ' 1 is Low
If Me!Risk_Type = 1 Then ' 1 is Type 1 Noncritical sour cased
well (no perfs)
Me!Inspection_Frequency = 5 ' Inspect every 5 years
ElseIf Me!Risk_Type = 2 Then ' 2 is Type 2 Gas well < 28,000
m3/d that is low risk
Me!Inspection_Frequency = 5 ' Inspect every 5 years
ElseIf Me!Risk_Type = 3 Then ' 3 is Type 3 Water source well
Me!Inspection_Frequency = 5 ' Inspect every 5 years
ElseIf Me!Risk_Type = 4 Then ' 4 is Type 4 Class 4 injector
Me!Inspection_Frequency = 5 ' Inspect every 5 years
Else: Me!Inspection_Frequency = 1 ' This would be for Type 5
Nonflowing oil wells < 50 mol/kmol H2S Content
End If
Case "2" ' 2 is Medium
If Me!Downhole_Option = 6 Then ' 6 is Option "1" Packer & Tubing
Plug
Me!Inspection_Frequency = 3 ' Inspect every 3 years
Else: Me!Inspection_Frequency = 5 ' This would be for 7 & 8
which is for Option "2" Bridge Plug and Option "3" Cavern Svc Wells
End If
Case "3" ' 3 is High
If Me!Downhole_Option = 9 Then ' 9 is Option "1" Packer & Tubing
Plug
Me!Inspection_Frequency = 1 ' Inspect every year
Else: Me!Inspection_Frequency = 5 ' This would be for 10 which
is Option "2" Bridge Plug capped w/ 8m lineal cement
End If
Case Else
Me!Inspection_Frequency = 0
End Select
End If ' test "Suspend
End Sub
Thanks!