AfterUpdate VB If statement

  • Thread starter Thread starter ArneGolf
  • Start date Start date
A

ArneGolf

I am having a problem with this code:
Private Sub Cart_Shed_Number_AfterUpdate()
If (Me.Cart_Shed_Number) = "NA" And (Me.Cart_Type) = "NA" Then
Me.Cart_Shed_Fee = "0"
ElseIf (Me.Cart_Shed_Number) >= "A" And (Me.Cart_Type) = "Gas" Then
Me.Cart_Shed_Fee = "10"
ElseIf (Me.Cart_Shed_Number) >= "A" And (Me.Cart_Type) = "Electric" Then
Me.Cart_Shed_Fee = "20"
End If
End Sub
I want it to auto populate a "cart shed fee" field on a form depending on
the answers to the "cart shed number and cart type" fields.
 
I am having a problem with this code:
Private Sub Cart_Shed_Number_AfterUpdate()
If (Me.Cart_Shed_Number) = "NA" And (Me.Cart_Type) = "NA" Then
Me.Cart_Shed_Fee = "0"
ElseIf (Me.Cart_Shed_Number) >= "A" And (Me.Cart_Type) = "Gas" Then
Me.Cart_Shed_Fee = "10"
ElseIf (Me.Cart_Shed_Number) >= "A" And (Me.Cart_Type) = "Electric" Then
Me.Cart_Shed_Fee = "20"
End If
End Sub
I want it to auto populate a "cart shed fee" field on a form depending on
the answers to the "cart shed number and cart type" fields.

And the problem is...? You didn't say.

What's the datatype of the Cart_Shed_Fee field in your table? I presume that
(despite its name) the Cart_Shed_Number is Text? Has the Cart_Type control
already been filled in when you select a value in Cart_Shed_Number?
 
Back
Top