Solved

Close query Access VBA

Posted on 2010-09-22
2
1,058 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
2 Comments
 
LVL 22

Accepted Solution

by:
Kelvin Sparks earned 500 total points
Comment Utility
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
Comment Utility
Perfect, understand, no need for a button i was using
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now