I'm hoping someone can provide some insight on this one. The following code worked using Access 2003, but no longer works with Access 2010. It fails on the Recordset.Addnew statement. The error message says: The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship.
Any suggestions would be greatly appreciated.
Private Sub cmdAddNew_Click()
On Error GoTo Err_cmdAddNew_Click
Me.AllowAdditions = True
Me.Filter = ""
Me.FilterOn = False
Me.OrderBy = "Project_ID"
Me.OrderByOn = True
Recordset.AddNew
Recordset.Update
Development_Site = GetDefaults("Site", 2)
Production_Site = GetDefaults("Site", 2)
Requery
Recordset.MoveLast
Me.AllowAdditions = False
Me.txtCreatedBy.Value = VBA.Environ$("UserName")
ShowData
Exit_cmdAddNew_Click:
Exit Sub
Err_cmdAddNew_Click:
MsgBox Err.Description
Resume Exit_cmdAddNew_Click
End Sub
Thanks!
Dionna