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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top