Private Sub Command98_Click()
Dim objAccObj As AccessObject
Dim objProj As Object, openFrm As Boolean
openFrm = True
Set objProj = Application.CurrentProject
For Each objAccObj In objProj.AllForms
If objAccObj.IsLoaded() And objAccObj.Name <> Me.Name And objAccObj.Name <> "frmMainForm" Then
openFrm = False
Exit For
End If
Next objAccObj
If openFrm Then _
DoCmd.OpenForm "frmMainForm"
DoCmd.Close acForm, "frmCandidates", acSaveYes
End Sub