Quit command in Access 2007

B

BethMc

Is there something different needed to use DoCmd.Quit (or the Quit action in
a macro) in 2007? I can't get it to close Access itself. Is there an
alternative action/command?
All assistance gratefully received -
 
B

BethMc

Other code has been working just fine, in a macro or through the Builder for
Event Procedures.
I had been trying to use DoCmd.Quit as the last action in an Event
Procedure for a check box OnClick event. The code is:

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "Jeep Rental Agreement Report", acViewNormal, "",
"[Guest ID]=[Forms]![Jeep Rental Agreement 2]![Guest ID]", acDialog
DoCmd.Close acReport, "Jeep Rental Agreement Report"
DoCmd.Close acForm, "Jeep Rental Agreement 2"
DoCmd.CloseDatabase
DoCmd.Quit

All of it ran fine except the last. DoCmd.Quit had absolutely no effect;
the database was gone, but Access was left sitting on the screen open to
mischief.
BUT--I have just now found a way around it. Soft of. I took the Quit
out of the procedure above, and instead put it as an Event Procedure for the
Form's OnClose property.
When I re-open the form, I get an error message that Quit is not
available, but Access closes when I need it to close, so I'll live with
cancelling the message (unless you have an idea how I can get rid of it).
Thank you so very much for responding! I know I've been on here an
awful lot lately, but this is the toughest program I've ever tried to
self-teach. Thanks again -
 
B

BethMc

Nope. No effect. But thank you very much for the suggestion. As stated in
the response to Linq, above, I've found a semi-satisfactory work-around.
BTW - how do I show that the question is being dropped, though without a
definitive answer? I don't feel I should just leave it sitting open.
Thank you again -
 
L

Larry Daugherty

They just sit there forever. People will usually be aware of the date
of posts and peruse the old ones for info but not respond to them.


HTH
 
P

Peter Hibbs

Beth,

In the code you posted you are closing the database before you issue
the Quit command so it never gets executed. Just delete the
DoCmd.CloseDatabase line from the code and it should work OK.

HTH

Peter Hibbs.
 
B

BethMc

Hallelujah! Thank you, Thank you, THANK YOU! You're the greatest!
--
Beth McCalley


Peter Hibbs said:
Beth,

In the code you posted you are closing the database before you issue
the Quit command so it never gets executed. Just delete the
DoCmd.CloseDatabase line from the code and it should work OK.

HTH

Peter Hibbs.

Other code has been working just fine, in a macro or through the Builder for
Event Procedures.
I had been trying to use DoCmd.Quit as the last action in an Event
Procedure for a check box OnClick event. The code is:

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "Jeep Rental Agreement Report", acViewNormal, "",
"[Guest ID]=[Forms]![Jeep Rental Agreement 2]![Guest ID]", acDialog
DoCmd.Close acReport, "Jeep Rental Agreement Report"
DoCmd.Close acForm, "Jeep Rental Agreement 2"
DoCmd.CloseDatabase
DoCmd.Quit

All of it ran fine except the last. DoCmd.Quit had absolutely no effect;
the database was gone, but Access was left sitting on the screen open to
mischief.
BUT--I have just now found a way around it. Soft of. I took the Quit
out of the procedure above, and instead put it as an Event Procedure for the
Form's OnClose property.
When I re-open the form, I get an error message that Quit is not
available, but Access closes when I need it to close, so I'll live with
cancelling the message (unless you have an idea how I can get rid of it).
Thank you so very much for responding! I know I've been on here an
awful lot lately, but this is the toughest program I've ever tried to
self-teach. Thanks again -
 

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