Writing Code in One Place

  • Thread starter Thread starter mnt
  • Start date Start date
M

mnt

I want to set three variables based on the form a user is on when they run a
method (via a macro). These variables are used in a few methods within 1
module. I don't want to have to go to many places in the code to change
values if needed. Suggestions for the best way to do this? Do I declare the
vars are public and pass the form name to a function? Any help is appreciated.
 
Sounds like a good idea to make life easier.
You can set up a function to return the value of a variable.

Here is an example:

Private Function FuncPersonID() As Long
If Not IsNull(Me.cboLastName) Then
FuncPersonID= " & Me.cboLastName & "
Else
FuncPersonID = 0
End If
End Function

Everywhere you want to use the value of LastName you can use FuncLastName

Jeanette Cunningham
 
Back
Top