Nov 7, 2007 #1 MalekTaus Programmer Joined Nov 5, 2007 Messages 10 Location US I am trying to create a sub procedure for cancel buttons across several forms. The problem is that I need to be able to pass the form object to the procedure in order to unload the form. Can anyone help?
I am trying to create a sub procedure for cancel buttons across several forms. The problem is that I need to be able to pass the form object to the procedure in order to unload the form. Can anyone help?
Nov 7, 2007 1 #2 S SkipVought Programmer Joined Dec 4, 2001 Messages 47,492 Location US Hi, Check out the Forms collection. Skip, When a diminutive clarvoyant had disappeared from detention, headlines read... Small Medium at Large Upvote 0 Downvote
Hi, Check out the Forms collection. Skip, When a diminutive clarvoyant had disappeared from detention, headlines read... Small Medium at Large
Nov 7, 2007 Thread starter #3 MalekTaus Programmer Joined Nov 5, 2007 Messages 10 Location US It was UserForm that I needed. Thanks for the help and here is my oh so simple solution Code: Private Sub btnCancel_Click() Call cancelButton(Me) End Sub Code: Sub cancelButton(frm As UserForm) Unload frm End Sub Upvote 0 Downvote
It was UserForm that I needed. Thanks for the help and here is my oh so simple solution Code: Private Sub btnCancel_Click() Call cancelButton(Me) End Sub Code: Sub cancelButton(frm As UserForm) Unload frm End Sub
Nov 8, 2007 #4 cresbydotcom Technical User Joined May 22, 2006 Messages 234 Form1.Show & Form1.Hide work for me - that way I can set values before it is visible. Or use the Activate/deactivate events to set things up. Upvote 0 Downvote
Form1.Show & Form1.Hide work for me - that way I can set values before it is visible. Or use the Activate/deactivate events to set things up.
Nov 8, 2007 #5 combo Technical User Joined Jan 1, 2003 Messages 4,198 Location PL As long as you do not want to interact with the form you try to close, without calling external procedure: Code: Private Sub btnCancel_Click() Unload Me End Sub combo Upvote 0 Downvote
As long as you do not want to interact with the form you try to close, without calling external procedure: Code: Private Sub btnCancel_Click() Unload Me End Sub combo