If you dont feel like reading my long post, I want to delete a query (after it's run) when the query window closes.
I know how to delete a query, it's more a question of finding how when a query window no longer exists, and triggering it to perform the deletion.
About myself:
I'm new to this site, and somewhat new to Access. I'm self-taught (the best way to go) =) I have had some experience in programming (not necessarily VB), but some C++. I've messed with Visual C++'s API (not using MFC). I know C++'s API gives more control when programming, but I can't really use that on the fly. I know Access's VB is scaled down, but was wondering if anyone had an answer. This leads me to my question.
The dB Background:
I hope this section answers some questions as to why I might be doing something. This dB is for someone at work to manage off-record accounts. Older women, that aren't tech-savy, use it. These women make mistakes and do things that might screw it up when I leave. They don't know how to run queries, so I've made a form to do it for them. There are about 10 - 15 fields that they can populate or leave blank, and just click "search" to find all the queries.
The Problem:
In a sub, I call on a function to check whether a query (queryName) exists; if it doesn't, it creates a new query (I'm using strSQL to store a SELECT statment).
I'm using a docmd.openquery to run the query, and have also set it to readonly.
at the end of the Sub i have a line that deletes the query. the problem with this is that users cannot use the "A-Z" or "Z-A" sort, to requery the data (because the query is deleted).
because they can't do that, i've commented out the delete query statement.
To anyone who can help:
I want to delete the query when the query window is closed. I need a way to check if the query window is open (maybe some way of storing the window's handle if possible), and a way to send a message when the window closes.
Please let me know.
I know how to delete a query, it's more a question of finding how when a query window no longer exists, and triggering it to perform the deletion.
About myself:
I'm new to this site, and somewhat new to Access. I'm self-taught (the best way to go) =) I have had some experience in programming (not necessarily VB), but some C++. I've messed with Visual C++'s API (not using MFC). I know C++'s API gives more control when programming, but I can't really use that on the fly. I know Access's VB is scaled down, but was wondering if anyone had an answer. This leads me to my question.
The dB Background:
I hope this section answers some questions as to why I might be doing something. This dB is for someone at work to manage off-record accounts. Older women, that aren't tech-savy, use it. These women make mistakes and do things that might screw it up when I leave. They don't know how to run queries, so I've made a form to do it for them. There are about 10 - 15 fields that they can populate or leave blank, and just click "search" to find all the queries.
The Problem:
In a sub, I call on a function to check whether a query (queryName) exists; if it doesn't, it creates a new query (I'm using strSQL to store a SELECT statment).
I'm using a docmd.openquery to run the query, and have also set it to readonly.
at the end of the Sub i have a line that deletes the query. the problem with this is that users cannot use the "A-Z" or "Z-A" sort, to requery the data (because the query is deleted).
because they can't do that, i've commented out the delete query statement.
To anyone who can help:
I want to delete the query when the query window is closed. I need a way to check if the query window is open (maybe some way of storing the window's handle if possible), and a way to send a message when the window closes.
Please let me know.
Last edited: