Public Function OpenAForm(strFormName As String) As Integer
On Error GoTo OpeningError
Dim strHide As String
strHide = Screen.ActiveForm.Name
Let errTag = Screen.ActiveForm.Name
Screen.ActiveForm.Visible = False
DoCmd.OpenForm strFormName, acNormal, , , , acWindowNormal
'DoCmd.Maximize
Screen.ActiveForm.Tag = strHide
Let errTag = Empty
Exit Function
OpeningError:
MsgBox ("OpenAForm!!! Unable to open form " & strFormName & Chr$(13) _
& "Please advise admin of the below message and the function you are trying to access: " & Chr$(13) _
& Chr$(13) & "Error Number: " & Err.Number & Chr$(13) & Chr$(13) & "Description : " & Err.Description)
End Function
Public Function BackAForm(strFormName As String) As Integer
On Error GoTo DisplayErr
Dim strForm As String
Dim strUnHide As String
Let strForm = Screen.ActiveForm.Name
Let strUnHide = Screen.ActiveForm.Tag
DoCmd.Close acForm, strForm
DoCmd.SelectObject acForm, strUnHide
'DoCmd.Maximize
Exit Function
DisplayErr:
MsgBox ("Unable to close the current screen or open next screen " & Chr$(13) _
& "Please advise admin of the below message and the function you are trying to access: " _
& Chr$(13) & Chr$(13) & "Error Number: " & Err.Number & Chr$(13) & Chr$(13) & "Description : " & Err.Description)
DoCmd.OpenForm strForm
End Function