Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to close an open  Microsoft Access file with vba

Posted on 2013-05-28
3
Medium Priority
?
2,494 Views
Last Modified: 2013-05-28
hi

I want that when I open a form in ACCESS it's  will give me an option to closing the current file. Is there a possibility in vba to do this?










I want that in some cases when I open a form ACCESS platform that will give me a chance to closing the file. Is there a possibility in vba closing the current file
0
Comment
Question by:bill201
[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
3 Comments
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 39200998
Not sure I understand your question.   Normally in VBA, you do:

Application.Quit

or

DoCmd.Quit

 to close and exit MS Access.

If you want to open another DB, the current one is automatically closed when the new one is opened.  In the Access UI, you can only have one DB open at a time.

 In code, you can open/close multiple databases (OpenDatabase() ).

Jim.
0
 

Author Comment

by:bill201
ID: 39201060
You understand what I mean, I wanted to close the current file in your code "docmd.quit" worked well many thanks
0
 

Author Closing Comment

by:bill201
ID: 39201061
You understand what I mean, I wanted to close the current file in your code "docmd.quit" worked well many thanks
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

704 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