• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1159
  • Last Modified:

Close query Access VBA


I am looking for the code to close queries after they have been run

I have
DoCmd.Close , acQuery, "Allotment"

But thats not working

Can someone advise of the full code?

1 Solution
Kelvin SparksCommented:
The only queries that remain open after running are the "SELECT" ones, the simple select query and the cross tab. You would only run these to view the data, and so you wouldn't want code to close them as they'd close as soon as run. Typically a user would close them using the X at the top right of a screen having reviewed the data.
The only other place you'd use them would be to populate a recordset, listbox or similar, but you don't open them for that.
Seamus2626Author Commented:
Perfect, understand, no need for a button i was using
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now