I have to keep a date input form open In order to run a report correctly, so I just minimize the form. So I am trying to move the close for that form into the close event for the report, but it will only seem to close the report and leaves the form minimized in the corner.
How can I get it to close both the form and the report, when I click on the close print preview button.
I feel like I have put my close statement everywhere and it won't close it.
Here is the code I currently have on my report close event. This is without any attempt to close the form.
Code:
Option Compare Database
Private Sub Report_Close()
If SysCmd(acSysCmdGetObjectState, acForm, "HomeScreen") > 0 Then
DoCmd.Close
If Forms!HomeScreen.Visible = False Then
Forms!HomeScreen.Visible = True
End If
ElseIf SysCmd(acSysCmdGetObjectState, acForm, "HomeScreen") = 0 Then
DoCmd.OpenForm "HomeScreen"
End If
End Sub