Hi there,
I have a small problem that hopefully someone can help me out with...
Basically I am running several dynamic reports, and I need to be able to check if the report is currently open, if it is, close it, then re-open the selected report type with the new datasource..
I have tried to do something like:
Unfortunately this doesn't work
I am not 100% that the IsLoaded syntax is a: correct or b: valid for a report??
I also have a module loaded with the following code (which is taken from a sample DB that is designed to check if a Form is loaded or not..)
Can anyone give me any pointers on this please??
Thanks in advance.
I have a small problem that hopefully someone can help me out with...
Basically I am running several dynamic reports, and I need to be able to check if the report is currently open, if it is, close it, then re-open the selected report type with the new datasource..
I have tried to do something like:
Code:
Dim rs As DAO.Recordset
Set rs = dbs.OpenRecordset("tblTable")
If IsLoaded(rs!ReportName) Then
DoCmd.Close rs!ReportName
DoCmd.OpenReport rs!ReportName, acViewPreview
Else
DoCmd.OpenReport rs!ReportName, acViewPreview
End If
Unfortunately this doesn't work
I am not 100% that the IsLoaded syntax is a: correct or b: valid for a report??
I also have a module loaded with the following code (which is taken from a sample DB that is designed to check if a Form is loaded or not..)
Code:
Function IsLoaded(ByVal stRptName As String) As Boolean
'New version from Northwind for Access 2002
'Returns True if the specified form is open in Form view or Datasheet view.
Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllReports(stRptName)
If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView <> acCurViewDesign Then
IsLoaded = True
End If
End If
End Function
Can anyone give me any pointers on this please??
Thanks in advance.