MLH <CR**@NorthState.net> wrote in
news:ur********************************@4ax.com:
You could pass the formname to the function on each call.
I realize that would mean modifying the call to your public
procedure on each and every form that calls it, but its sure
to work.
That's not the best solution, as you'd then have to look up the form
in the forms collection.
The best solution is to pass a form reference as a parameter of your
subroutine:
Public Sub DoSomething(frm As Form)
Set frm.Visible = True
[etc.]
End Sub
And you'd call it in any form like this:
Call DoSomething(Me)
That passes (By Reference) a pointer to the original form instance.
Passing the name would then require a lookup, and that's
inefficient.
Also, doing it with passing the form reference means that "Me" in
your subroutine can simply be replaced with "frm", whereas you'd
still have to set up some kind of object within the subroutine if
passing the form name (though you could do a WITH block, if it
worked for the code you had there).
--
David W. Fenton
http://www.bway.net/~dfenton
dfenton at bway dot net
http://www.bway.net/~dfassoc