you cannot add or change a record

R

Rick A

The user can add some data to a form but decide not to finish. They click the close button, the "X" in the upper right hand corner. How do I trap for this and if something is entered on the form ignore it.

I'm receiving the error "You cannot add or change a record because...". Referential integrity is turned on and the form is complaining.

While I'm at it, what's the code to turn off this message?

Thanks,
 
S

strive4peace

Hi Rick,

the first time you press ESCape, it undoes changes to the
fireld you are in

if the field is not the first one you have changed, press
ESCape again to undo changes to the record

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
 
R

Rick A

Crystal,

I could ask the user to hit the ESC key first but that's not intuitive. The
user clicks the close button and I need to trap for this error. How do I do
that?
 
S

strive4peace

if me.dirty then me.undo


Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
 

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