I have a form that allows people to add new employees but they need to be able to edit or update the existing employees as well.
So I added a button to allow them to make changes right on the form, click the update button and the record they were working on would be updated right away.
When I tested it however the string runs and even pops up a warning letting you know you are about to permanently change a record. But then it throws up an error stating "did not update record due to Key Violation"
I have included my "On Click" Event code
DoCmd.RunSQL "UPDATE EntList " & _
"SET EntList.BusinessUnit = '" & Me.cboBUnit & "', EntList.EntityName = '" & Me.txtEntName & "', EntList.Position = '" & Me.txtPos & "', EntList.Location = '" & Me.cboLoc & "', EntList.Client = '" & Me.cboClient & "', EntList.Dept = '" & Me.cboDept & "', EntList.DistKey = '" & Me.txtDistKey & "', EntList.Salary = '" & Me.txtSalary & "', Entlist.Currency = '" & Me.cboCurrency & "', EntList.[SG&A] = '" & Me.txtSG_A & "', EntList.BillRate = '" & Me.txtBillRate & "', EntList.[Util%] = '" & Me.txtUtil_ & "', EntList.MeritDate = '" & Me.txtMeritDate & "', EntList.[Merit%] = '" & Me.txtMerit_ & "' " & _
"WHERE EntList.EntityID = '" & Me.txtEntID.Value & "';"
I am wondering what I am missing that is causing this error.