|
 |
access thread: detecting if query window is open.
Message #1 by daniel.eugen@m... on Tue, 23 Oct 2001 20:58:08
|
|
Hello and help!
Here is what I have been striving to do.
I am working with Access 97. I have read about the .StillExisting method,
but I don't think it applies in this situation.
What I am doing is creating a temporary query and saving it to a query
called TEMPQUERY.
I then display this query's results in datasheet view. What I would like
to do is put code into my procedure that detects when this datasheet
window has been closed and then... and only then.... to go and delete the
temporary query file.
What is happening now is that TEMPQUERY is being erased immediately after
it's created, and I'm left with the "orphaned" datasheet window open.
Thank you for any help.
Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Tue, 23 Oct 2001 13:35:26 -0700
|
|
That's a tough one. The ridiculously complex SysCmd() function may be of
use here--it'll tell you whether your query is still open. Anytime
SysCmd(acSysCmdGetObjectState, acQuery, "TEMPQUERY") returns 0, the query is
closed. You might could come up with some loop that calls this function
until it returns 0 & then do your delete. That seems very inelegant to me
tho (and your app may act oddly while it's waiting for the user to close
TEMPQUERY--display flicker, less responsive than usual--that sort of thing).
Maybe someone else can think of a better way.
One other thing to consider--leave the query be & just delete it right
before you need to create it the next time. That is, in the proc where you
create the query, first try to delete it. You can trap for the error that
arises when the query doesn't exist & just do a Resume Next. If you don't
want your users messing with it, set its hidden property to True.
HTH,
-Roy
Roy Pardee
Programmer/Analyst
SWFPAC Lockheed Martin IT
(xxx) xxx-xxxx
-----Original Message-----
From: daniel.eugen@m... [mailto:daniel.eugen@m...]
Sent: Tuesday, October 23, 2001 1:58 PM
To: Access
Subject: [access] detecting if query window is open.
Hello and help!
Here is what I have been striving to do.
I am working with Access 97. I have read about the .StillExisting method,
but I don't think it applies in this situation.
What I am doing is creating a temporary query and saving it to a query
called TEMPQUERY.
I then display this query's results in datasheet view. What I would like
to do is put code into my procedure that detects when this datasheet
window has been closed and then... and only then.... to go and delete the
temporary query file.
What is happening now is that TEMPQUERY is being erased immediately after
it's created, and I'm left with the "orphaned" datasheet window open.
Thank you for any help.
Message #3 by daniel.eugen@m... on Wed, 24 Oct 2001 14:42:36
|
|
It's amazing how when you get stuck in one frame of thought you just can't
think outside that box.
The solution to check for and delete the temporary query before having to
create it again is ... ingenious. So simple.
A thousand thank-you's.
> That's a tough one. The ridiculously complex SysCmd() function may be of
> use here--it'll tell you whether your query is still open. Anytime
> SysCmd(acSysCmdGetObjectState, acQuery, "TEMPQUERY") returns 0, the
query is
> closed. You might could come up with some loop that calls this function
> until it returns 0 & then do your delete. That seems very inelegant to
me
> tho (and your app may act oddly while it's waiting for the user to close
> TEMPQUERY--display flicker, less responsive than usual--that sort of
thing).
> Maybe someone else can think of a better way.
>
> One other thing to consider--leave the query be & just delete it right
> before you need to create it the next time. That is, in the proc where
you
> create the query, first try to delete it. You can trap for the error
that
> arises when the query doesn't exist & just do a Resume Next. If you
don't
> want your users messing with it, set its hidden property to True.
>
> HTH,
>
> -Roy
>
> Roy Pardee
> Programmer/Analyst
> SWFPAC Lockheed Martin IT
> (xxx) xxx-xxxx
>
> -----Original Message-----
> From: daniel.eugen@m... [mailto:daniel.eugen@m...]
> Sent: Tuesday, October 23, 2001 1:58 PM
> To: Access
> Subject: [access] detecting if query window is open.
>
>
> Hello and help!
>
> Here is what I have been striving to do.
>
> I am working with Access 97. I have read about the .StillExisting
method,
> but I don't think it applies in this situation.
>
> What I am doing is creating a temporary query and saving it to a query
> called TEMPQUERY.
>
> I then display this query's results in datasheet view. What I would
like
> to do is put code into my procedure that detects when this datasheet
> window has been closed and then... and only then.... to go and delete
the
> temporary query file.
>
> What is happening now is that TEMPQUERY is being erased immediately
after
> it's created, and I'm left with the "orphaned" datasheet window open.
>
> Thank you for any help.
|
|
 |