Parameter Query

G

Guest

I have a parameter query set up and when I click on a button the parameter
pop-up screen appears and ask you to enter data. If I enter the data it
works fine but when I click on the cancel button a screen called "Action
Failed" pops-up and ask you to click on the 'Halt" button to cancel. I am
using a Macro for the command for the button to open the query. How do I
prevent that from happening? It only happens when I have a parameter query
using using a button that is controlled by a macro.
Thanks.
 
R

Rick Brandt

E-mail report using Lotus Notes rather t said:
I have a parameter query set up and when I click on a button the
parameter pop-up screen appears and ask you to enter data. If I
enter the data it works fine but when I click on the cancel button a
screen called "Action Failed" pops-up and ask you to click on the
'Halt" button to cancel. I am using a Macro for the command for the
button to open the query. How do I prevent that from happening? It
only happens when I have a parameter query using using a button that
is controlled by a macro.
Thanks.

Don't use macros (no error handling). If you call the query from code you can
have an error handler that ignores the error caused by cancelling the query.
 
K

Ken Snell \(MVP\)

As you're discovering, macros don't give you the ability to catch/handle
errors.

You should use a form to allow the user to enter the parameter value (into a
textbox, for example), then have the macro (or VBA code) check if the
textbox has a value or not -- if it doesn't, the macro stops and doesn't run
the query; if it does, the query reads the value from the form's textbox
(use a parameter of [Forms]![NameOfTheForm]![NameOfTheTextbox] in your query
instead of the parameter that you're currently using).


--

Ken Snell
<MS ACCESS MVP>


"E-mail report using Lotus Notes rather t"
 

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