Open Report (1 Viewer)

Rosebud

Registered User.
Local time
Today, 06:39
Joined
Dec 5, 2000
Messages
28
Does anyone know the code behind determining if a form/report is already open? I have a command button that opens a report, and if the report is already open, I would like to stop code behind the button and display a message box. Thanks

Rosebud
 

Louise

Registered User.
Local time
Today, 06:39
Joined
Oct 28, 1999
Messages
26
You could try something along these lines:

Dim intReports As Integer, rpt As Report
Dim ReportName As String

intReports = Reports.Count
If intReports = 0 Then
Exit Sub
Else:
For Each rpt In Reports
ReportName = rpt.Name
If ReportName = "Your Report Name" Then
MsgBox "This report is already open"
End If
Next rpt
End If

I use a modified version of this to determine if a report is open and if so to leave a form open or close it or whatever is required. I find it quite effective.

You could probably also set up some sort of variable and an additional looping structure if you wanted to check against all your report names, depending on how many you have.

Hope this helps. email me if any of this needs further clarification.
 

Users who are viewing this thread

Top Bottom