N
nybaseball22
Hello. I am using the following code in a form in OnCurrent and
AfterUpdate field. However, when it is initiated, I receive a debug
error. Any idea what I am doing wrong with this or how I can change
it to make it work?
Thanks.
On Current and Type_AfterUpdate Private subs
Private Sub Form_Current()
If Me.Type = "Oil" Then
Me.Gallon_Rate.Enabled = True
Me.Gallon_Quantity.Enabled = True
Me.Total_Cost.Enabled = True
Me.Bill_Period_Start.Enabled = False
Me.Bill_Period_End.Enabled = False
Me.KWH.Enabled = False
Me.Charges.Enabled = False
ElseIf Me.Type = "Electricity" Then
Me.Gallon_Rate.Enabled = False
Me.Gallon_Quantity.Enabled = False
Me.Total_Cost.Enabled = False
Me.Bill_Period_Start.Enabled = True
Me.Bill_Period_End.Enabled = True
Me.KWH.Enabled = True
Me.Charges.Enabled = True
ElseIf Me.Type <> "Oil" And Me.Type <> "Electricity" Then
Me.Gallon_Rate.Enabled = False
Me.Gallon_Quantity.Enabled = False
Me.Total_Cost.Enabled = False
Me.Bill_Period_Start.Enabled = True
Me.Bill_Period_End.Enabled = True
Me.KWH.Enabled = False
Me.Charges.Enabled = True
Else
' Any other options
End If
End Sub
AfterUpdate field. However, when it is initiated, I receive a debug
error. Any idea what I am doing wrong with this or how I can change
it to make it work?
Thanks.
On Current and Type_AfterUpdate Private subs
Private Sub Form_Current()
If Me.Type = "Oil" Then
Me.Gallon_Rate.Enabled = True
Me.Gallon_Quantity.Enabled = True
Me.Total_Cost.Enabled = True
Me.Bill_Period_Start.Enabled = False
Me.Bill_Period_End.Enabled = False
Me.KWH.Enabled = False
Me.Charges.Enabled = False
ElseIf Me.Type = "Electricity" Then
Me.Gallon_Rate.Enabled = False
Me.Gallon_Quantity.Enabled = False
Me.Total_Cost.Enabled = False
Me.Bill_Period_Start.Enabled = True
Me.Bill_Period_End.Enabled = True
Me.KWH.Enabled = True
Me.Charges.Enabled = True
ElseIf Me.Type <> "Oil" And Me.Type <> "Electricity" Then
Me.Gallon_Rate.Enabled = False
Me.Gallon_Quantity.Enabled = False
Me.Total_Cost.Enabled = False
Me.Bill_Period_Start.Enabled = True
Me.Bill_Period_End.Enabled = True
Me.KWH.Enabled = False
Me.Charges.Enabled = True
Else
' Any other options
End If
End Sub