N
Newbie
Hi,
I have a procedure that is supposed to close all open forms and then open
the mainform
If I step through procedure it works ok but if I let it run the whole
database gets closed
Why is this and what do I need to do to fix it?
Here is my procedure that is called from the Click event on a form
************code starts*****************
Public Function unloaded()
Dim fNum As Integer
If Forms.Count = 0 Then
Exit Function
End If
For fNum = Forms.Count - 1 To 0 Step -1
DoCmd.Close
Next fNum
DoEvents
DoCmd.OpenForm "frmMainMenu", acNormal, , , acFormEdit, acWindowNormal
DoEvents
End Function
*************code ends***************
Here is the OnClick event code that calls the above:
************code starts***************
Private Sub btnClose_Click()
Call modDeclarations.unloaded
DoCmd.Close acForm, "frmError", acSaveYes
End Sub
*********code ends*****************
I have a procedure that is supposed to close all open forms and then open
the mainform
If I step through procedure it works ok but if I let it run the whole
database gets closed
Why is this and what do I need to do to fix it?
Here is my procedure that is called from the Click event on a form
************code starts*****************
Public Function unloaded()
Dim fNum As Integer
If Forms.Count = 0 Then
Exit Function
End If
For fNum = Forms.Count - 1 To 0 Step -1
DoCmd.Close
Next fNum
DoEvents
DoCmd.OpenForm "frmMainMenu", acNormal, , , acFormEdit, acWindowNormal
DoEvents
End Function
*************code ends***************
Here is the OnClick event code that calls the above:
************code starts***************
Private Sub btnClose_Click()
Call modDeclarations.unloaded
DoCmd.Close acForm, "frmError", acSaveYes
End Sub
*********code ends*****************