Saving, quiting data

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

I have a form sourced to a table that has a subform that is sourced to
another table. The first form has relation of 1 to many of the subform. I
want to have a command button that will quit(close) the form and undo the
changes to the records in both the form and the subform.

I have somewhat figured out a way by using "docmd acundo" and "docmd.close
in a command button although I always get a message that "Relationships that
specify cascading delets are about to cause 1 records in this table and in
related tables to be deleted" =Yes,No. If I click yes everything works
like it should, but if I click no then it closes the form and leaves the
unwanted data in the table.

Questions:
How do I eliminate the default message box?
Is the best way to handle quitting forms?
 
to stop the warning message, i believe you can add the following line of
code before the Undo action, as

DoCmd.SetWarnings False

*make sure* you turn the warnings back on after the Close action, as

DoCmd.SetWarnings True

based on the info you gave, i don't see any reason to refrain from using
DoCmd.Close to close the form.

hth
 
Back
Top