Putting a query into the closet

kupe

Registered User.
Local time
Today, 15:49
Joined
Jan 16, 2003
Messages
462
A command button runs a query, and another closes it. But, of course, before the query is closed, it has to be moved out of the way so the Close button can be reached. This might confuse the User - or have him do something wrong.

Would the query do its stuff properly if I put the open and close commands on the one button?

Is there a correct way to program it so the query will do its stuff out of sight, please, Experts?
 
Would the query do its stuff properly if I put the open and close commands on the one button?
Yes, just set up a button that first checks to see if the query is currently open or not. If not, open it. If yes, close it. You can use this function (courtesy of Access 2000 Developer's Handbook) to test if an object is loaded:

Function IsLoaded(strName As String, _
  Optional lngType As AcObjectType = acForm) As Boolean

  IsLoaded = (SysCmd(acSysCmdGetObjectState, lngType, strName) <> 0)
End Function


What do you mean by having a query do it's stuff "out of sight"? There's no way to open a query in a hidden window. Though you can hide the query after it's been opened using the DoCmd.RunCommand acCmdWindowHide command.
 
Thanks very much, DCX693, that looks very good. Thanks for the knowledge. Thanks too to the Developers Handbook - which I'm saving up for. Very grateful.
 
No problem. You should definately buy that book!
 
You mentioned it to Kila a little while ago - well, the 2002 edition - and I made a note of it then. All the best.
 

Users who are viewing this thread

Back
Top Bottom