How do I check to see if the report is open? I want to be able to check if a report is open and if so close it so that the user can open the report again, but with different criteria.
Function ReportIsLoaded(MyReportName As String) As Boolean
'
' Determines if a Report is loaded.
'
Dim i As Integer
ReportIsLoaded = False
For i = 0 To Reports.Count - 1
If Reports(i).Name = MyReportName Then
ReportIsLoaded = True
Exit Function ' Quit function once form has been found.
End If
Next i
End Function
Here is how to call the function:
If IsLoaded.ReportIsLoaded("Report_Name" Then
DoCmd.Close acReport "Report_Name"
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.