add code exit the database when form is closed.

M

mon

Hi again, how do I adjust the below code to close the form
and exit the database? Thanks mon

Private Sub Command37_Click()
On Error GoTo Err_Command37_Click
DoCmd.Close
Exit_Command37_Click:
Exit Sub
Err_Command37_Click:
MsgBox Err.Description
Resume Exit_Command37_Click
End Sub
 
D

Dan Artuso

Application.Quit
will close the db for you.
You already have a DoCmd.Close
for the form, I take it. Is it not working?
 
M

mon

Thanks Dan
Yes the form closes OK, but I want the whole thing to
close. Do I fit application.Quit into the Button Code
somewhere or does it have to go somewhere else?
Thanks Mon
 
S

Steve Schapel

Mon,

Try this...

DoCmd.Close acForm, Me.Name
DoCmd.Quit

- Steve Schapel, Microsoft Access MVP
 

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