Close Current Database Without Exiting Access

C

Clint Marshall

I am trying to create a command button on an Access XP form that will close
the current Access database without exiting the Access Application. This is
preferred because it will save time the next time we open another database.

I notice that this functionality isn't available from the file menu. What
I'm trying to achieve is the equivalent of clicking the "x" on the database
window.

I can't figure out the code and it's not available in the command button
wizard.

Can anyone guide me or direct me to the code I need?

Thank you!

-Clint Marshall
 
R

Rick Brandt

Clint said:
I am trying to create a command button on an Access XP form that will
close the current Access database without exiting the Access
Application. This is preferred because it will save time the next
time we open another database.
I notice that this functionality isn't available from the file menu. What I'm
trying to achieve is the equivalent of clicking the "x" on
the database window.

I can't figure out the code and it's not available in the command
button wizard.

Can anyone guide me or direct me to the code I need?

Application.CloseCurrentDatabase
 
M

Marshall Barton

Clint said:
I am trying to create a command button on an Access XP form that will close
the current Access database without exiting the Access Application. This is
preferred because it will save time the next time we open another database.

I notice that this functionality isn't available from the file menu. What
I'm trying to achieve is the equivalent of clicking the "x" on the database
window.

I can't figure out the code and it's not available in the command button
wizard.

Can anyone guide me or direct me to the code I need?


Closing the Database Window is available in the menus by
first selecting the Database Window and then using the
File - Close menu item.

If you want to do this through a form button, then use:
Application.CloseCurrentDatabase

If you only want to hide the database window, use:
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top