Solved Closing an Open Form when a user select a New one

Local time
Today, 12:41
Joined
Jun 3, 2022
Messages
38
Hello! I have a MainMenu Form where a user can click on one form and it opens up to something. Is there a way for the MainMenu or previous form to close automatically?

MainMenu
frmBusiness (Example of form)

For example, a user selects a frmBusiness on the MainMenu, the MainMenu disappears in the background, then the frmBusiness opens up. The user fills in the information, etc. and now wants to go back to the MainMenu. The user clicks "MainMenu cmd button" on the frmBusiness and goes back to the MainMenu, but the frmBusiness form closes.

Its basically having One Form opening up and the previous one closes. Would appreciate the help! Thanks!!
 
If you're using code from the main form to open the selected form, you can amend that code to close or hide the main form first.
 
Yes, I just have the Access Wizard command button to open the form, but what is the code to close or hide the main form first
 
For example,

DoCmd.Close acForm, Me.Name
 
Why specify a hardcoded name, when you already know the name? :(
 
Usually, when I open formB from formA, I'm going to want to go back to formA when I close formB. The technique to do that is to hide the current form after opening the new form rather than closing it and pass the name of the calling form in the OpenArgs. Here it is in action.
 

Attachments

Users who are viewing this thread

Back
Top Bottom