How do I run the same procedure from multiple controls?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a number of checkbox controls and I would like to run the same
procedure with each of them. I was wondering if there is an easier way to
doing this other than typing the same code for all the check boxes?
Thanks,
 
AMN,
Create a Sub with the common code, say...
Private Sub MyChkRoutine()
'do some routine here
End Sub

Then call that sub in each of the checkboxes, say...
Private Sub MyChkBox1_AfterUpdate()
'do some stuff if needed and then...
MyChkRoutine
End Sub.
 
Create a Sub or Function procedure containing the common code and then each
button click event will call the common procedure. If need be, each button
can pass an argument to the common procedure if you do need to differentiate
in some way.
Good luck.
 
Thank you very much for your help.

Al Camp said:
AMN,
Create a Sub with the common code, say...
Private Sub MyChkRoutine()
'do some routine here
End Sub

Then call that sub in each of the checkboxes, say...
Private Sub MyChkBox1_AfterUpdate()
'do some stuff if needed and then...
MyChkRoutine
End Sub.

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
Back
Top