Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Close query Access VBA

Posted on 2010-09-22
2
Medium Priority
?
1,117 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

618 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