C
Carrie
Hello,
For some reason, though I have tried to post on my original question (nested
If problem) 3 times, nothing has shown up. I have had some help on this
site, to write some VB code to evaluate 4 different fields in my form and
return the appropriate Inspection Frequency. I was advised that I then
needed to call it from the After Update Event of each of my 4 fields (because
any one could change, which would change the inspection frequency)
I put it on each event as Me.RecalcInspectionFrequency.Requery but it isn't
working, which I believe could be because RecalcInspectionFrequency is not an
actual field.
Could someone please advise, how do I call this so that it will update?
Thanks!!!!!
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
For some reason, though I have tried to post on my original question (nested
If problem) 3 times, nothing has shown up. I have had some help on this
site, to write some VB code to evaluate 4 different fields in my form and
return the appropriate Inspection Frequency. I was advised that I then
needed to call it from the After Update Event of each of my 4 fields (because
any one could change, which would change the inspection frequency)
I put it on each event as Me.RecalcInspectionFrequency.Requery but it isn't
working, which I believe could be because RecalcInspectionFrequency is not an
actual field.
Could someone please advise, how do I call this so that it will update?
Thanks!!!!!
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