help with canceling dataentry form data...

B

Brook

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
 
J

John Spencer

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
 
B

Brook

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
 
J

John Spencer

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.
 
Top