help with canceling dataentry form data...

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

Guest

good day all,

I have a dataentryform that I use to enter info into a table from a
cbolookup.

On the form I have an "OK" button and a "Cancel" button.

the OK button works fine and accepts the data, however, I for the cancel
button. I want the form to close with accepting any changes that have been
typed into the form fields... how is this possible?

any suggestions?

Thanks,

Brook
 
If this is a form with no subform, you can use code in the Cancel button's click
event to UNDO the changes and then close the form
Sample (UNTESTED) code

Me.Undo '<-- undoes all unsaved changes to the form
DoCmd.Close acForm, Me.Name
 
good day John,

I set it up like you suggested, however when I click the close button I
get a runtime error 2498.

an Expression you entered is the wrong data type for one of the arguements?

Any ideas?

Thanks for the post.... and suggestions..

Brook
 
Strange, it works for me. I just retested it.

What version of Access are you using?

Did you enter the code exactly as posted? No substitutions.
 
Good Day John,

I had an extra " . " in one of the pieces of code.

It works fine now.. thanks for the help!

Brook
 
Back
Top