CancelEvent in BeforeUpdate still allows attempt to write record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

1) I am using Forms with built-in macros. The file being written has a
multi-field key to detect duplicate entries. How can I prevent the system
error messages when a duplicate is detected? Is there an error number that
will let me correct the entry before the attempt to write the record?
2) Putting a conditional CancelEvent in the BeforeUpdate macro does not seem
to stop the attempt to write the record. What else is needed?
 
CancelEvent in the BeforeUpdate event of the *form* will prevent the record
being written.

If that's not enough for what you need, you can use the Error event of the
form to trap engine-level errors.
 
Thanks for the reply. What you suggest is just about what I learnt from the
standard Help file. The conclusion seems to be that I shall have to use some
VBA to read the "engine-level" error numbers. I was hoping to do everything
with macros.
 
As you found, macros are not enough to handle errors like the ones you are
trying to catch. VBA code provides so much more!
 

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

Back
Top