Testing to see if a query is open

  • Thread starter Thread starter Philippe
  • Start date Start date
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
 
-----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 >
 
Back
Top