close form - parameter request pops up

B

bpauley

Hello All,
I have a problem when I close a form. I am getting a popup asking for the
parameters in a query that filters info for a combo box on the form. I am
closing the form with a command button. This is the code behind the command
button.
```````````````````````````````````````````````
Private Sub cmdCloseCurrentfrm_Click()
On Error GoTo Err_cmdCloseCurrentfrm_Click

DoCmd.Close

Exit_cmdCloseCurrentfrm_Click:
Exit Sub

Err_cmdCloseCurrentfrm_Click:
MsgBox Err.Description
Resume Exit_cmdCloseCurrentfrm_Click

End Sub

````````````````````````````````````````````````
If I close the from with the X in the top right corner, I get no popup for
the parameters. Same if I use the close by going to "file", "close".
How do I eliminate the popup from displaying when closing the form?
Thank you
Bill
 
B

bpauley

Hello Gina,
Thanks for your reply.
I have found a thread involving the same type question that I had. Marshall
Barton replied to a poster with a microsoft kb article. I read the article
and added two lines of code to the command button that closes the form.
DoCmd.Echo.False then true after the close line.

It is as follows
``````````````````````````
Private Sub cmdCloseCurrentfrm_Click()
On Error GoTo Err_cmdCloseCurrentfrm_Click
DoCmd.Echo False
DoCmd.Close
DoCmd.Echo True

Exit_cmdCloseCurrentfrm_Click:
Exit Sub

Err_cmdCloseCurrentfrm_Click:
MsgBox Err.Description
Resume Exit_cmdCloseCurrentfrm_Click

End Sub

``````````````````````````````````````````

It cured the problem.
Here is the ms kb article Marshall referred to.
http://support.microsoft.com/kb/811860/en-us
Thank you
Bill
 

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