Testing to see if a query is open

P

Philippe

Hi,

I am trying to write a module to test if a query is open.

Function IsQueryOpen(pstrQuery As String) As Integer
Dim db As DAO.Database
Dim qd As DAO.QueryDef
Set db = CurrentDb
Set qd = db.QueryDefs(pstrQuery)
Set qd = Nothing
Set db = Nothing
End Function

But then I don't know what property i have to use to test
if it is open?

Thanks

:p hilippe
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use this:

Function IsOpen(strName As String, _
Optional intType As Integer = acForm) As Boolean

' Get the current state of the named object

isLoaded = SysCmd(acSysCmdGetObjectState, _
intType, strName) = acObjStateOpen

End Function

This is sometimes called the IsLoaded() function - available in the
sample database Northwind.

Call it like this:

Dim blnIsOpen As Boolean
blnIsOpen = IsOpen("query name", acQuery)


MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)


-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQD+684echKqOuFEgEQKf/wCePzh7dZHGaIBYy4NDsDZsmD8QBK0Amwcr
KDZqtXA0ITY/95QrNLI/Qj46
=kJ3z
-----END PGP SIGNATURE-----

Hi,

I am trying to write a module to test if a query is open.

< SNIP >
 

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