Is there a function in Access VBA to check if a query is open, if so close?
Posted on 2009-05-06
I have a dynamic query builder designed in MS Access set up with a main Form for the user. I have noticed that if the user clicks away from the query window after it has run, it becomes 'hidden' behind the form and the user can not close it without going into the back end of the db. I have a refresh button which closes the form then immediately reopens it and a view query button which runs and opens the query as defined by the user. For both buttons, I want them to check to see if the query is open and if it is close it before doing anything else.
How can this be done?