callng Sub

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?
 
R

Rick Brandt

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.
 
B

Barry Gilbert

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
 
Top