Solved

Close query Access VBA

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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 …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

739 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