Making a form level Sub Public

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

Guest

I want to activate a button on form two from form one. For the button I want
to activate, I changed the Private to Public and renamed the sub to make it
unique within the project. I coppied the name of the sub and pasted it in
the sub on form one from which I want to activate the button on form two.

I get a Sub or Function not defined error and I don't understand why!
'Public' makes the sub public throughout the entire project even if it is in
a form or report module. Correct?
 
After making it public, you still need to use a full reference to the module
of the form.

If the form is named Form1, then the module is Form_Form1. So if the
procecure is named MyButton_Click, try:
Call Form_Form1.MyButton_Click
 
That did it. Thank you much!

Allen Browne said:
After making it public, you still need to use a full reference to the module
of the form.

If the form is named Form1, then the module is Form_Form1. So if the
procecure is named MyButton_Click, try:
Call Form_Form1.MyButton_Click
 
Back
Top