Avatar of Fordraiders
Fordraiders
Flag for United States of America

asked on 

updating a field in a subform with a calculation from 2 other fields

Access 2010   vba

I'm updating a field in a subform with a calculation from 2 other fields.

Is there an easier way to write this  code ?



' =====================================
Dim g As String
Dim j As String

g = Me!RENEWAL_ESCALATED_PRICE_INCREASE_FRM
j = Me!ESTIMATED_REVENUE_IMPACT_FRM

' ============================================
'  < 4%
If g < 4 And j < 250 Then
Me!ACTION_NEEDED_FRM = "Update Quote"
End If
' < 4%
If g < 4 And j > 250 And j < 1000 Then
Me!ACTION_NEEDED_FRM = "RSVP/Director Approval"
End If
' < 4%
If g < 4 And j > 1000 Then
Me!ACTION_NEEDED_FRM = "FVP Approval"
End If


' =========================================
'  >4  and < 8%
If g > 4 And g < 8 And j < 250 Then
 Me!ACTION_NEEDED_FRM = "Update Quote"
End If

'  >4  and < 8%
If g > 4 And g < 8 And j > 250 And j < 1000 Then
Me!ACTION_NEEDED_FRM = "RSVP/Director Approval"
End If

'  >4  and < 8%
If g > 4 And g < 8 And j > 1000 Then
 Me!ACTION_NEEDED_FRM = "RSVP/Director Approval"
End If

' ===========================================
'  > 8%
If g > 8 And j < 250 Then
Me!ACTION_NEEDED_FRM = "Update Quote"
End If
' > 8%
If g > 8 And j > 250 And j < 1000 Then
Me!ACTION_NEEDED_FRM = "Update Quote"
End If
' > 8%
If g > 8 And j > 1000 Then
Me!ACTION_NEEDED_FRM = "Update Quote"
End If
Microsoft AccessVBA

Avatar of undefined
Last Comment
PatHartman

8/22/2022 - Mon