Martin Caro
mcaro at bigpond.net.au
Sat Mar 27 17:46:53 CST 2004
At times I have 3 or 4 forms open at once and may want to return to the main menu form from any of those and at the same time closing all forms except the main menu form. Can anyone tell me why the following function after closing only one form via the Case else will not continue to work through the forms group and close multiple forms?
Public Function CloseForms(FromForm As String)
Dim frm As Form
For Each frm In Forms
Select Case frm.Name
Case Is = "frmMainMenu"
'Dont close it
Case Is = FromForm
'Dont close the form that called this yet
Case Else
'Close any other form
MsgBox ("The form being closed is " & frm.Name)
DoCmd.close acForm, frm.Name, acSaveNo
End Select
Next frm
End Function
Martin