Closing a form after it loses the focus

G

Guest

Hi all

I have a DateRange form that has 2 text boxes and 2 command buttons. The text boxes are to receive start and end dates and the buttons are 1) to open a print preview or 2) to close the DateRange form (i.e. to cancel)

When button 1 is pushed, the preview is launched as desired. I would also like to close the DateRange form when button 1 is pushed, since it is no longer required. I tried the DoCmd.Close within button 1 event code but I can't find the right place to put it

Any suggestions would be appreciated

Cheers
Jody
 
A

Arvin Meyer

Put the close code after the open form code, and use this form to make sure
the code is easily readable:

DoCmd.Close acForm, "The name of the form to close"
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Jody said:
Hi all,

I have a DateRange form that has 2 text boxes and 2 command buttons. The
text boxes are to receive start and end dates and the buttons are 1) to open
a print preview or 2) to close the DateRange form (i.e. to cancel).
When button 1 is pushed, the preview is launched as desired. I would also
like to close the DateRange form when button 1 is pushed, since it is no
longer required. I tried the DoCmd.Close within button 1 event code but I
can't find the right place to put it.
 
G

Guest

worked like a charm! Thanks Arvin

Jod

----- Arvin Meyer wrote: ----

Put the close code after the open form code, and use this form to make sur
the code is easily readable

DoCmd.Close acForm, "The name of the form to close
--
Arvin Meyer, MCP, MV
Microsoft Acces
Free Access downloads
http://www.datastrat.co
http://www.mvps.org/acces

Jody said:
text boxes are to receive start and end dates and the buttons are 1) to ope
a print preview or 2) to close the DateRange form (i.e. to cancel)like to close the DateRange form when button 1 is pushed, since it is n
longer required. I tried the DoCmd.Close within button 1 event code but
can't find the right place to put it
 

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