View Full Version : Cancelled but Query still runs


Sherri1509
01-24-2002, 11:04 AM
I have some reports that uses an unbounded form to enter filter criteria for beginning and ending date on the report. The form has a CANCEL and an OK botton. The OK button works fine. However when the cancelled botton is click the query stills runs requesting the paramaters. The onclick on the CANCEL button calls this function.

Private Sub FormCancel_Click()
DoCmd.Close acForm, Me.Name
End Sub

How can I get this query from still running?


Macros are created for the form.

It has a CancelEvent macro that is suppose to cancel printing or previewing of the report. The macro has condition:

Not FunctionName("FormName")

There is also a macro for the Cancel Button. Its action is set to close
The cancel button has onclick properties set to Formname.Cancel

I followed the instruction in MS Access Help. This can be found by entering criteria"form to enter report criteria"



[This message has been edited by Sherri1509 (edited 01-24-2002).]

jwindon
01-24-2002, 11:25 AM
What happens before you get to this form?

Have you checked the names of the command buttons to be sure that they are different from each other?

Sherri1509
01-29-2002, 06:59 AM
The form has some macros behind it. One to open,close,cancel, OK, and cancel event

D B Lawson
01-29-2002, 07:14 AM
Try:

Private Sub FormCancel_Click()
Cancel = true
End Sub

Sherri1509
01-29-2002, 08:36 AM
I tried that, but it did not work. Thanks

fscheer
03-10-2002, 05:36 PM
I don't know if you are still checking the post re: Qry still runs after cancelling event/closing form posted by qckslvr1999, but I have figured out a relatively easy way to get the second, default, parameter prompt to not appear after cancelling a custom dialog parameter form. It's nothing fancy, but it does work. Here's the URL of the page where the post should be. Hope it helps, if you still need it.
http://www.access-programmers.co.uk/ubb/Forum3/HTML/002838.html

good luck
Fawn

Sherri1509
03-11-2002, 11:07 AM
Thanks. It worked perfectly if not run from a switch board. However my message when run from a switch board is "There was an Error executing the command"

fscheer
03-12-2002, 09:05 AM
Not sure why the error, but it may just be an issue of needing to recreate the command button that is used inthe switchboard to run the report.