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 31st, 2010, 01:13 PM posted to microsoft.public.access.forms
cel504
external usenet poster
 
Posts: 39
Default Closing forms, help please.

Could someone give me some advice please. I have a switchboard form in my
database and from here I move to other forms and then return to the
switchboard after reviewing, how do I get the forms to close when I return to
the switchboard again? I have read a few of the threads, yet still can't get
my head around it at the moment. Any advice would be greatly appreciated.
  #2  
Old January 31st, 2010, 01:40 PM posted to microsoft.public.access.forms
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Closing forms, help please.

CEL504 wrote:
Could someone give me some advice please. I have a switchboard form in my
database and from here I move to other forms and then return to the
switchboard after reviewing, how do I get the forms to close when I return to
the switchboard again? I have read a few of the threads, yet still can't get
my head around it at the moment. Any advice would be greatly appreciated.


Are you sure you want to do that? If you _really_ want to do that, you could
write some code that closed all open forms except the switchboard whenever
you set focus to the switchboard form.

That's a weird way of doing things... at least to me. Normally you close
your forms explicitly. If you're sure you want to cause this to happen, this
should do it.

Private Sub Form_Activate()

Dim frm As Form
Dim i As Integer

' create an array of form names
Dim frmName() As String
ReDim frmName(Forms.Count)

' populate the array with names.
For Each frm In Forms
i = i + 1
frmName(i) = frm.Name
Next frm

' dimming a variable here is bad programming...

Dim intX As Integer
' loop through the array
For intX = 1 To i
If frmName(intX) Me.Name Then '--- don't close the
switchboard...
DoCmd.Close acForm, frmName(intX), acSaveNo
End If
Next intX
End Sub

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #3  
Old January 31st, 2010, 03:26 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default Closing forms, help please.

I have to agree with Pieter, this is a strange approach! Why not simply close
the form? If the Switchboard is still open focus will then return to it.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #4  
Old January 31st, 2010, 09:02 PM posted to microsoft.public.access.forms
Rob Parker[_3_]
external usenet poster
 
Posts: 173
Default Closing forms, help please.

Did you see this reply I posted to your previous post of this same question
a few days ago?


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 give me some advice please. I have a switchboard form
in my database and from here I move to other forms and then return to
the switchboard after reviewing, how do I get the forms to close when
I return to the switchboard again? I have read a few of the threads,
yet still can't get my head around it at the moment. Any advice would
be greatly appreciated.



 




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 04:23 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.