callng Sub

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I can remember reading that you can call a sub by entering 1 line of code.
So If in my OnLoad Event I wanted to use the code in the Afterupdate event
of a checkbox I could just type

Sub chkBoxname_AfterUpdate()

Have I just dreamt this? If Not then could someone tell me how it is done?
 
Chris said:
I can remember reading that you can call a sub by entering 1 line of code.
So If in my OnLoad Event I wanted to use the code in the Afterupdate event
of a checkbox I could just type

Sub chkBoxname_AfterUpdate()

Have I just dreamt this? If Not then could someone tell me how it is
done?

Call chkBoxname_AfterUpdate()


Actually the "Call" is not required, but I like to include it because it
makes the line more self-documenting.
 
Chris,

A best practice is to put only minimal code in your event handlers, just
enough to call private subs. Then you can call these subs from any event.

HTH,
Barry
 
Back
Top