I have a form with a buttom that opens a report. When the report opens, the report_close() function runs for no reason. I've included some of my code. Any ideas what's going on?
FORM:
If (IsReportLoaded(rptMyReport)=True) Then
DoCmd.Close acReport, rptMyReport
Forms!frmMyForm.SetFocus
DoCmd.Minimize
DoCmd.OpenReport rptMyReport, acViewPreview
Reports!rptMyReport.Filter = condition
Else
DoCmd.Minimize
DoCmd.OpenReport rptMyReport, acViewPreview
Reports!rptMyReport.Filter=condition
End If
REPORT:
Private Sub Report_Close()
MsgBox ("Test"
If (IsFormLoaded(frmMyForm)) Then
Forms!frmMyForm.SetFocus
DoCmd.Restore
Forms!frmMyForm!txtTextField.SetFocus
End If
End Sub
When the report is open in the background, the message box "Test" appears twice.
FORM:
If (IsReportLoaded(rptMyReport)=True) Then
DoCmd.Close acReport, rptMyReport
Forms!frmMyForm.SetFocus
DoCmd.Minimize
DoCmd.OpenReport rptMyReport, acViewPreview
Reports!rptMyReport.Filter = condition
Else
DoCmd.Minimize
DoCmd.OpenReport rptMyReport, acViewPreview
Reports!rptMyReport.Filter=condition
End If
REPORT:
Private Sub Report_Close()
MsgBox ("Test"
If (IsFormLoaded(frmMyForm)) Then
Forms!frmMyForm.SetFocus
DoCmd.Restore
Forms!frmMyForm!txtTextField.SetFocus
End If
End Sub
When the report is open in the background, the message box "Test" appears twice.