Here is an example of the code I am working with.
I have two forms that use the same module to set values on the form. What
I
am trying to do is be able to use the code for any form and not hardcode
the
form name. This even more pressing when assigning values to fields on a
subforms.
If (Len(Me.TicketSelection) = 0) Then
Forms![EMail Automation1]![CPkg] = ""
Forms![EMail Automation1]![CPkg].Visible = False
Forms![EMail Automation1]![PackageLbl].Visible = False
Forms![EMail Automation1]![MessageArea].Visible = False
Forms![EMail Automation1]![MessageArea] = ""
Else
Me.TicketSelection = Translate(Me.TicketSelection, Me.TicketNumber &
",", "")
End If
John Spencer said:
Since you didn't post the code you are using, specific advice is
impossible.
I assume that you want to pass the form or formname as an argument to a
subroutine (a sub or function).
Public Sub ChangeTheValue (FormRef as Form)
With FormRef
'Do something here
End With
End Sub
It might make more sense to pass in the actual control on the form and
modify the value there.