If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Closing forms help please,
Could someone please help me? I have read some of the threads relating to
closing forms, how and where do you write the code to close one form, when you open another one. My example is, I have a switchboard form from where I navigate around the database. Various buttons open the forms I need. How can I get the previous form to close when a new one is selected. Do I write the command on the button? I have read some of the other threads, but just can't get my head around it at the moment. As ever, thanks for help and advice given. Cel504 |
#2
|
|||
|
|||
Closing forms help please,
On Jan 27, 4:10*pm, CEL504 wrote:
Could someone please help me? I have read some of the threads relating to closing forms, how and where do you write the code to close one form, when you open another one. *My example is, I have a switchboard form from where I navigate around the database. Various buttons open the forms I need. How can I get the previous form to close when a new one is selected. Do I write the command on the button? I have read some of the other threads, but just can't get my head around it at the moment. As ever, thanks for help and advice given. Cel504 In the button's click event that opens the next form, end the routine with Me.Close |
#3
|
|||
|
|||
Closing forms help please,
If you're really wanting to control the user interface to prevent people
from having lots of different forms open at the same time - due to the switchboard form being always available - then the easiest way is to hide (rather than close) the switchboard form when another form is opened, and show it again when the other form is closed. To do this, you'd use code such as this: In the event of the button on the switchboard form to open the new form: Me.Visible = False DoCmd.OpenForm "frmNewFormName" In the close event of frmNewFormName: Forms("frmSwitchboard").Visible = True Putting this code in the Close event of the form ensures that it will always run, regardless of how the user closes the form. If you've set up your form (and menus) so that the user can only close the form via a command button you have supplied, then you can put this code in the Click event of your close button. HTH, Rob CEL504 wrote: Could someone please help me? I have read some of the threads relating to closing forms, how and where do you write the code to close one form, when you open another one. My example is, I have a switchboard form from where I navigate around the database. Various buttons open the forms I need. How can I get the previous form to close when a new one is selected. Do I write the command on the button? I have read some of the other threads, but just can't get my head around it at the moment. As ever, thanks for help and advice given. Cel504 |
Thread Tools | |
Display Modes | |
|
|