Solved

Close query Access VBA

Posted on 2010-09-22
2
1,088 Views
Last Modified: 2013-11-27

Hi,

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?

Thanks
Seamus
0
Comment
Question by:Seamus2626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
Kelvin Sparks earned 500 total points
ID: 33732755
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.
 
Kelvin
0
 

Author Closing Comment

by:Seamus2626
ID: 33732831
Perfect, understand, no need for a button i was using
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question