AfterUpdate VB If statement

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.
 
J

John W. Vinson

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top