same button on multiple pages

R

Robin

Hi
I have a multipage form and I would like to know if it's possible to link
the "on click" code to similar buttons on the different pages. For example,
on each form, I have a NEXT button which takes you to the next page. I would
like to know if the same code can be assigned to each NEXT button, instead of
having many different CommandButtonxx_click codes. It would be great to just
refer each button to say a cbNext_click() code.
Thanks!
 
J

Joel

You need to have one macro for each button. but you can combine the code if
you are smart

Private Sub CommandButton1_Click()
call Commonbutton()
End Sub

Private Sub CommandButton1_Click()
call Commonbutton()

End Sub

Private Sub CommandButton1_Click()
call Commonbutton()

End Sub

'put into a module
Sub Commonbutton()

'put common code here
exit Sub
 
D

Dave Peterson

Hi
I have a multipage form and I would like to know if it's possible to link
the "on click" code to similar buttons on the different pages. For example,
on each form, I have a NEXT button which takes you to the next page. I would
like to know if the same code can be assigned to each NEXT button, instead of
having many different CommandButtonxx_click codes. It would be great to just
refer each button to say a cbNext_click() code.
Thanks!
 

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

Top