Programmatically Close a form

H

Hank

I have a form with an onclick event. I want to close this form when I have
clicked what I want and the other form has opened. It usually covers the form
that I used to get to the new one. What would I need to write as a last
statement to close the form after the on click event has been handled???
Please help, I am really stuck with this simple thing!!
 
D

Dirk Goldgar

Hank said:
I have a form with an onclick event. I want to close this form when I have
clicked what I want and the other form has opened. It usually covers the
form
that I used to get to the new one. What would I need to write as a last
statement to close the form after the on click event has been handled???
Please help, I am really stuck with this simple thing!!


To open a new form and close the current one, the code and be as simple as:

'----- start of example code -----
Private Sub cmdOpenNewForm_Click()

DoCmd.OpenForm "YourNewForm"
DoCmd.Close acForm, Me.Name, acSaveNo

End Sub
'----- end of example code -----
 

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