A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Closing forms help please,



 
 
Thread Tools Display Modes
  #1  
Old January 27th, 2010, 11:10 PM posted to microsoft.public.access.forms
cel504
external usenet poster
 
Posts: 39
Default 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  
Old January 28th, 2010, 09:21 AM posted to microsoft.public.access.forms
Piet Linden[_2_]
external usenet poster
 
Posts: 280
Default 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  
Old January 28th, 2010, 10:12 PM posted to microsoft.public.access.forms
Rob Parker[_3_]
external usenet poster
 
Posts: 173
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:26 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.