Repost: Determining whether a query is open

D

Dale Fye

Posted this message about a week ago, but never got an
answer.

I have several queries (complicated cross-tabs) that I
have not had the time or energy to turn into reports yet.

In my application, the user selects one or more reports
(or queries for those that I haven't finished the report
for) from a list box. When they click a command button,
the code loops through the selected reports/queries and
allow the user to print or preview the item.

I have code in the loop that prevents it from going to the
next selected item until the currently displayed item
(report/query) is closed. This works with the reports,
because I am able to look at the Reports collection to
determine whether the report is open, but I have not
figured out how to do this with the queries.

If anyone knows how to determine whether a report is open,
in code, I would greatly appreciate it.

Thanks.

Dale
 
J

Jonathan Parminter

-----Original Message-----
Posted this message about a week ago, but never got an
answer.

I have several queries (complicated cross-tabs) that I
have not had the time or energy to turn into reports yet.

In my application, the user selects one or more reports
(or queries for those that I haven't finished the report
for) from a list box. When they click a command button,
the code loops through the selected reports/queries and
allow the user to print or preview the item.

I have code in the loop that prevents it from going to the
next selected item until the currently displayed item
(report/query) is closed. This works with the reports,
because I am able to look at the Reports collection to
determine whether the report is open, but I have not
figured out how to do this with the queries.

If anyone knows how to determine whether a report is open,
in code, I would greatly appreciate it.

Thanks.

Dale
.
Hi Dale,

the following example is from the Northwind sample
database supplied with MS Access....


Public Function IsLoaded(ByVal strFormName As String) As
Integer
' Returns True if the specified form is open in Form view
or Datasheet view.

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strFormName)
<> conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView
Then
IsLoaded = True
End If
End If

End Function

Perhaps you can modify this function to suit your needs.

Luck
Jonathan
 
D

Dale Fye

Thanks, Jonathan

That worked.


Jonathan Parminter said:
Hi Dale,

the following example is from the Northwind sample
database supplied with MS Access....


Public Function IsLoaded(ByVal strFormName As String) As
Integer
' Returns True if the specified form is open in Form view
or Datasheet view.

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strFormName)
<> conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView
Then
IsLoaded = True
End If
End If

End Function

Perhaps you can modify this function to suit your needs.

Luck
Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top