Switchboard and Closing Forms

  • Thread starter Thread starter Novice2000
  • Start date Start date
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.
 
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 <--
 
Thanks I will play with that. But, I am failry unfamiliar with Visual Basic.
Any advice on entering this?
 
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 <--
 
Back
Top