Switchboard and Closing Forms

N

Novice2000

Hello
I created a Switchboard to act as the main menu for several forms. I used
command buttons to navigate from page to page. My question/problem is that I
noticed the forms stay open after you navigate back to the switchboard.

Is there any way to have these forms close when you navigate away from them?
Thank you in advance.
 
S

Stefan Hoffmann

hi,
I created a Switchboard to act as the main menu for several forms. I used
command buttons to navigate from page to page. My question/problem is that I
noticed the forms stay open after you navigate back to the switchboard.
I would iterate through

Application.Forms

and close the open forms before opening the next form, e.g.

Option Compare Database
Option Explicit

Private Sub CloseAllOtherForms()

Dim frm As Access.Form

Dim Count As Long
Dim Index As Long
Dim Names() As String

Count = Application.Forms.Count - 1
ReDim frmNames(0 To Count)

For Index = 0 To Count
frmNames(Index) = Application.Forms.Item(Index).Name
Next Index

For Index = 0 To Count
If frmNames(Index) <> Me.Name Then
DoCmd.Close acForm, frmNames(Index)
End If
Next Index

End Sub


mfG
--> stefan <--
 
N

Novice2000

Thanks I will play with that. But, I am failry unfamiliar with Visual Basic.
Any advice on entering this?
 
S

Stefan Hoffmann

hi,
Thanks I will play with that. But, I am failry unfamiliar with Visual Basic.
Any advice on entering this?
Is it a standard switchboard created by the wizard? Which Access version?


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Closing forms help please, 2
Form Closing. 1
Closing Forms. 5
Closing forms, help please. 3
Help with Switchboard 5
Switchboard Form 3
Switchboard 2
Access Switchboard 1

Top