N
nybaseball22
Hello. I have a code that grays out text boxes in my form. I use it
in several forms and use it in OnCurrent, AfterUpdate, etc. I want to
change it to a Public Function in a module and call it from the
forms. Is there a way I need to change this? When I try to do it, I
get an error on the 7th line. One problem, I think, is that when I
open some of the forms, the Expense_Type is null. For that matter,
when I open one of the forms, all the fields are null, so I think I
need to add an IsNull - Do nothing code.
Private Sub Expense_Type_AfterUpdate()
If Me.Expense_Type = "Mileage" Then
Me.Amount.Enabled = False
Me.Mileage.Enabled = True
Me.MileageAmount.Enabled = True
ElseIf Me.Expense_Type <> "Mileage" Then
Me.Amount.Enabled = True
Me.Mileage.Enabled = False
Me.MileageAmount.Enabled = False
Else
' Any other options
End If
End Sub
I have changed this to a Function in my module and removed the Me.'s.
Thanks
in several forms and use it in OnCurrent, AfterUpdate, etc. I want to
change it to a Public Function in a module and call it from the
forms. Is there a way I need to change this? When I try to do it, I
get an error on the 7th line. One problem, I think, is that when I
open some of the forms, the Expense_Type is null. For that matter,
when I open one of the forms, all the fields are null, so I think I
need to add an IsNull - Do nothing code.
Private Sub Expense_Type_AfterUpdate()
If Me.Expense_Type = "Mileage" Then
Me.Amount.Enabled = False
Me.Mileage.Enabled = True
Me.MileageAmount.Enabled = True
ElseIf Me.Expense_Type <> "Mileage" Then
Me.Amount.Enabled = True
Me.Mileage.Enabled = False
Me.MileageAmount.Enabled = False
Else
' Any other options
End If
End Sub
I have changed this to a Function in my module and removed the Me.'s.
Thanks