I have a form that I use to enter data into a table. I put a button at the
bottom of the form that I can use if I decide to cancel and exit the form if
I change my mind. However, when I use the Cancel button it closes the form
but also puts the data into a new record in the database. This happens even
if I blank out all the fields. I am using the dbCmd.close function. Is there
an option I can add to this function to tell it not to save? Or is there a
cancel function that would do this? I'm fairly new at this so hopefully
there is an easy way to do it.
Thanks, Jack
DoCmd.Close does the same thing as closing the form with the X in the
upper-right corner. MSFT had to choose between cancelling that record,
or saving it. They chose the latter. I would argue rightfully so.
So what you want to do in your Cancel button is first to cancel saving
the record, then close the form:
RunCommand acCmdUndo
DoCmd.Close
-Tom.
>I have a form that I use to enter data into a table. I put a button at the
>bottom of the form that I can use if I decide to cancel and exit the form if
[quoted text clipped - 6 lines]
>
>Thanks, Jack
Jack Witt - 17 Jan 2008 20:24 GMT
Thanks, Tom. That fixed it!
Jack
> DoCmd.Close does the same thing as closing the form with the X in the
> upper-right corner. MSFT had to choose between cancelling that record,
[quoted text clipped - 19 lines]
>>
>>Thanks, Jack