DoCmd.Close not saving data.

  • Thread starter Thread starter John Keith
  • Start date Start date
J

John Keith

"DoCmd.Close acForm, Me.Name, acSaveYes"

Using Access 2003

Help Text...
Note If a form has a control bound to a field that has its Required
property set to 'Yes,' and the form is closed using the Close method without
entering any data for that field, an error message is not displayed. Any
changes made to the record will be aborted. When the form is closed using the
Windows Close button, the Close action in a macro, or selecting Close from
the File menu, Microsoft Access displays an alert....

My underlying table has 13 fields, 2 of which are set as required (primary
key - SSN and Last Name), the other 11 fields are NOT required and nulls ARE
allowed. Why does the close command abort the changes unless ALL 13 fields
are not null?
 
John

First, re-read the syntax explanation in Access HELP for the DoCmd.Close
acForm ... If I recall correctly, the "acSaveYes" setting saves, not the
data entered, but the structure of the form!

Commonly, entering data in a bound form (i.e., bound to data in a table or
in an updateable query), then moving to another record or closing the form
results in the data being saved.

How are you confirming that the data is not being saved?

If you aren't receiving any warnings, is there a chance your SetWarnings has
been turned off?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top