Reference to the same event in all the objects

  • Thread starter Thread starter Frank Dulk
  • Start date Start date
F

Frank Dulk

I want the same procedure to be evoked by the same event in all the objects
of my form. In other words, When Receiving Focus or When Moving Mouse or
before Updating etc.
Now, I make reference one for one. Would some exist way of doing that
reference " in block "? for instance: in the event When Receiving Focus of
ANY object of this form, execute this procedure.

Something like that:

Dim ctrl Control
Dim frm Form
set frm = Screen.ActiveForm
With each ctrl in frm.Controls
With ctrl_BeforeUpdate...
 
No, but you can in place of opening up the code builder, selecting code,
inserting code is simply place the name of the function in the property
sheet

=MyCustBeforeUpdate()

So,if you out of say 30 controls on the screen, need 10 of them to run the
above code on the "got focus" event, you in design mode simply highlight all
10 of the controls, and then type the above function name in the appropriate
event setting. The name of the function will be entered into all 10
controls. Not ideal, but certainly a lot better then opening each of the 10
controls, and putting a call to the routine in the code window.

Of couse, what you really asking for is a contorl array like VB has, where
each member in the array does in fact share the same event...but no can do
in ms-access!
 
Back
Top