Closing strategy

E

Eric G

I would like to be able to close my main data input form in two ways:

a) when a 'Done' button is clicked or when the 'x' in the top right
corner is clicked a few commands are executed, then the form is closed
and the db is exited (quit).

b) Double-clicking a certain label on the form closes the form but
does NOT quit the db.

Help in setting this up would be appreciated.

I had it set up alright with the Done button issuing the quit
command, but I know users will use the 'x' button in the top right
corner as well. I don't know how to code for pressing the 'x' button.
It seems to me this is simply tied into the form closing.
And I can't issue the Quit command with the form closing, or my
'escape route' of clicking another label will close the db on me as
well.

TIA Eric
 
A

Albert D. Kallal

You can always use the forms close event.

so, if you have a button that closes the form list

docmd.close

Or the user hits the X, then the code in the on-close event will run in both
cases.
 
E

Eric G

Hi Albert,

Yes I was using the form's close event, but I was coupling that with
a 'Quit' command as well. This works as desired.

Now, in addition, I want to be able to close the form and NOT quit
the application.
Having a close and quit command in the form's close event will not
allow me to achieve this.

Any ideas? Thanks. Eric
 
B

Bob Noll

How about this: declare a boolean globally in your form
code. When the boolean is true you quit, if false you
don't. In Form_Load set it to true, if the user clicks
the label have the click event set it to false.
 
E

Eric G

Hi Bob,

I'm happy to report that I used your method and it seems to be
working perfectly.
Thanks very much!

Eric
 

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