Andrew said:
Has anyone found a way of dynamically calling a controls, say after update
event.
Hard coded i would normally use:
ProjectName.Form_frmForm.txtControlName_AfterUpdate
I am after a way of replacing the form name and control event with variables.
You should not use the Form_formname syntax to refer to a
form instance. That syntax is used to refer to the form's
class, not to reference an instance of the form object.
If you only have one instance of the form open, then the
standard syntax is to use:
Forms!formname.procedurename args
or
Forms("formname").procedurename args
or
strfrm = "formname"
Forms(strfrm).procedurename args
or, if you prefer, you can use the Call statement
Call Forms(strfrm).procedurename(args)
(Note the important distinction of the parenthesis around
the arguments when you use Call.)
Remember that every public procedure in a form's module is a
method of that class and the syntax is the same as as
referencing any of its properties or methods.
If you have multiple instances of the forms, then you must
manage those instances with your own collection and use the
specific instance of the form object that you want to call.