Detect Report Open

PearlGI

Registered User.
Local time
Today, 15:39
Joined
Aug 30, 2001
Messages
125
How do you detect if any reports are open in preview mode?

With a Form you can use the CurrentView property, but this doesn't exist for reports.

I can detect if a report is open (Reports.Count), but I need to know whether this is in design or preview mode.
 
Last edited:
Yes, I've already looked at that and that is for forms not reports, the CurrentView property doesn't exist for reports!
 
Does this work?
The next example illustrates how you can use the SysCmd function with the acSysCmdGetObjectState action argument to determine the state of the active database object.

Dim intObjType As Integer, strObjName As String, intObjState As Integer

intObjType = Application.CurrentObjectType
strObjName = Application.CurrentObjectName
intObjState = SysCmd(acSysCmdGetObjectState, intObjType, strObjName)
If intObjState <> 0 Then
.
.
.
End If
 
Rich, I feel we're getting closer, but this is still not quite what I'm looking for (although the code you provided may prove useful in the future!)

acSysCmdGetObjectState only has 3 return values:

- Open
- New
- ChangedButNotSaved

I need to be able to determine between a report open in design mode and a report open in preview mode.

Thanks
 
There is an IsVisible function which you could use on the OpenEvent of the report, any help
 
Thanks for the reply.

Still not going to be of use though. Let me explain more fully.

I have a make-table query that is set to run every 15 mins. In order for this to work no reports can be open in preview mode (design mode is okay) else the make-table query cause an error.

A few users use this database and they are free to setup and design their own reports. Therefore, I need to be able to detect if any reports are in preview mode so the code that runs the make-table query can be by-passed until the next scheduled time.

Of course, I can continue to use Reports.Count, but this stops the make-table even in design mode (and the users tend to have the reports in design mode for some length of time - which stops the data updating!)

Any suggestions gratefully received.
 

Users who are viewing this thread

Back
Top Bottom