SBendBuckeye
Programmer
I have a generic function I use with ActiveControl on a form. It works for almost all cases, but a few times I need it to do a little bit more. I would like to pass in another sub as a parm and have it execute it something like the following:
GenericFunction(ctl As Control, Optional Another1 As String)
If Len(Another1) Then
Application.Run Another1
End If
etc.
I know I can't use Eval because that requires a function to be passed to it, but is there an equivalent or am I missing something obvious?
The Another1 above is a form class sub. No matter how I qualify it: "Form_frmName.Another1", "frmName.Another1",
"ME.Another1", etc I get the error message that Access can't find it.
My generic function is also contained in the form class module. I am invoking it as
=GenericFunction(screen.ActiveControl) in the On Got Focus event of my form controls to do some special processing. I am hoping to avoid having separate ones for each control and don't want to put in a case statement to execute Another1.
Thanks in advance for any help and have a great day!
Please remember to give helpful posts the stars they deserve! This makes the post more visible to others in need!![[thumbsup] [thumbsup] [thumbsup]](/data/assets/smilies/thumbsup.gif)
GenericFunction(ctl As Control, Optional Another1 As String)
If Len(Another1) Then
Application.Run Another1
End If
etc.
I know I can't use Eval because that requires a function to be passed to it, but is there an equivalent or am I missing something obvious?
The Another1 above is a form class sub. No matter how I qualify it: "Form_frmName.Another1", "frmName.Another1",
"ME.Another1", etc I get the error message that Access can't find it.
My generic function is also contained in the form class module. I am invoking it as
=GenericFunction(screen.ActiveControl) in the On Got Focus event of my form controls to do some special processing. I am hoping to avoid having separate ones for each control and don't want to put in a case statement to execute Another1.
Thanks in advance for any help and have a great day!
Please remember to give helpful posts the stars they deserve! This makes the post more visible to others in need!
![[thumbsup] [thumbsup] [thumbsup]](/data/assets/smilies/thumbsup.gif)