Prev: Yes/No Field Size
Next: If you buy the world's best and the cheapest batteries will not blame me
From: CEL504 on 27 Jan 2010 17:10 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
From: Piet Linden on 28 Jan 2010 03:21 On Jan 27, 4:10 pm, CEL504 <CEL...(a)discussions.microsoft.com> 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
From: Rob Parker on 28 Jan 2010 16:12 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
|
Pages: 1 Prev: Yes/No Field Size Next: If you buy the world's best and the cheapest batteries will not blame me |