Cancelling query launched from macro

H

Howard Brody

I'd try it with code.

In the OnClick property line, right click to get the
Build... option and select EventProcedure. When the VB
window opens, use this code:

Private Sub CommandButtonName_Click()
DoCmd.OpenQuery "qryQueryName", acViewNormal
End Sub

Hope this helps!

Howard Brody
 
T

Tom McMillion

Thanks so much for your help. That was close but if I
cancel the macro rather than entering data and clicking
OK, it returns the following error message:

Run time error '2001':
You cancelled the previous operation

I went back and looked at the code to verify it is a
duplicate of what you stated here. Any thoughts?

Thanks again,
Tom
 

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