I have a public function, Foobar, in a module that can be called from FormA, FormB, or FormC. Each of these forms contains a field we'll call Output. The output of Foobar is in part determined by where the function was called from. I.E.
Public Function Foobar (arg1, arg2)
if CalledFrom(FormA) then
Forms.FormA.Output = "blahA"
elseif CalledFrom(FormB) then
Forms.FormB.Output = "blahB"
elseif CalledFrom(FormC) then
Forms.FormC.Output = "blahC"
End If
Another approach would be something like
for each thing in CallingForm.Controls
if thing.name = "Output"
thing = "blah"
End if
next thing
Is there a neat way to determine which Form has called Foobar without including this as an argument? I have tried Screen.ActiveForm, but calling the function seems to take the focus off of the original form and I get an error.
Public Function Foobar (arg1, arg2)
if CalledFrom(FormA) then
Forms.FormA.Output = "blahA"
elseif CalledFrom(FormB) then
Forms.FormB.Output = "blahB"
elseif CalledFrom(FormC) then
Forms.FormC.Output = "blahC"
End If
Another approach would be something like
for each thing in CallingForm.Controls
if thing.name = "Output"
thing = "blah"
End if
next thing
Is there a neat way to determine which Form has called Foobar without including this as an argument? I have tried Screen.ActiveForm, but calling the function seems to take the focus off of the original form and I get an error.