Saving Records in a Subform

  • Thread starter Thread starter James Tully via AccessMonster.com
  • Start date Start date
J

James Tully via AccessMonster.com

I am using:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

In a subform under a save button to save a record after an add of a new
record to a table with a primary key that does not allow duplicates. I
allow the user to add more records with a new record button which uses:
DoCmd.GoToRecord , , acNewRec

The subform is closed only when the parent form closes. After adding one
or more records, saving them and closing I always get the error or warning:

?The changes you requested to the table were not successful because they
would create duplicate values in the index, primary key, or relationship.
Change the data in the field or fields that contain duplicate data, remove
the index, or redefine the index to permit duplicate entries and try again.?

The form closes OK and the records added are there and do not have
duplicate keys.

My question is why the message? Doesn?t DoCmd save menu call clear the
?dirty? flag? Seems like Access trying to save again at form close.
 
Back
Top