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 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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|