close form when command button clicked and another form opens

Slow Learner

Registered User.
Local time
Yesterday, 20:29
Joined
Oct 7, 2004
Messages
17
Have managed to:
Create a form with command buttons
Have the command buttons open the form, document (hyperlink), or report asked for
Now want to have the original form with the command button disappear and only the form or report show on the screen.
What is the best way to accomplish this? Can you have 2 onclick events on the same button? Or would you put a close in something else?
 
You don't need 2 click events, just string the code together:

Code:
Private Sub ButtonName_Click()
  DoCmd.OpenForm "NewFormName"
  DoCmd.Close acForm, "OldFormName"
End Sub
 
Code:
Private Sub ButtonName_Click()
  DoCmd.OpenForm "NewFormName"
  DoCmd.Close acForm, Me.Name [COLOR=Green]'close current form[/COLOR]
End Sub
 

Users who are viewing this thread

Back
Top Bottom