Re: how to determine whether any report is opened?



Zlatko Matiæ wrote:
How could I determine, in VBA, whether any report (print preview) is currently opened?

Function OpenReports() As Variant Dim rpt As Access.AccessObject Dim s As String

  For Each rpt In Application.CurrentProject.AllReports
    With rpt
      If .IsLoaded Then
        If .CurrentView = acCurViewPreview Then
          s = s & "," & .Name
        End If
      End If
    End With
  Next rpt

  OpenReports = Split(Mid$(s, 2), ",")

End Function


Sub showOpenReports() Dim v As Variant Dim i As Integer

  v = OpenReports()

  For i = 0 To UBound(v)
    Debug.Print v(i)
  Next

End Sub
.



Relevant Pages


Loading