Run-time error '3059'

G

Guest

In the event a button is clicked, macro would execute DoCmd.RunSQL to insert
a record. When I tested it, I answered "No" to popup message "You are about
to append 1 row(s)." and got ""Run-time error '3059': Operation Canceled by
user.". When I clicked Debug, it highligted the DoCmd.RunSQL line.

It's been working last Friday. Any idea what's causing this ?
 
B

Bob Quintal

... and by the way, I choose "Yes" to that popup, a record would
be added without a problem.
What are you expecting? you are the user, you cancelled the update.
Access is in verbose mode and gives you all these messages,

If you want to turn off the messages, modify the macro to perform a
setwarnings no before the insert of a new record and setwarnings yes
again after.
 
G

Guest

I don't expect anything when I answer "No" but why would it return a run-time
error. Anyway, I'll try setwarnings.
 
B

Bob Quintal

I don't expect anything when I answer "No" but why would it return
a run-time error. Anyway, I'll try setwarnings.
Why: Anything that breaks the running of a program is an error.
Cancelling a process from the keyboard may be done deliberately, but
it could be due to an accident, a defective keyboard, etc. Being
able to use an error handler to treat any or all these things is
useful to programmers.

Q.

Bob Quintal said:
What are you expecting? you are the user, you cancelled the
update. Access is in verbose mode and gives you all these
messages,

If you want to turn off the messages, modify the macro to perform
a setwarnings no before the insert of a new record and
setwarnings yes again after.
 

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