Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding/editing a record after searching for it

Status
Not open for further replies.

jason12776

Technical User
Nov 15, 2001
93
US
I am using ADODC and using access 2000. I have a form that enables a user to search for an item using an item id. When the user clicks on the search button, a new form appears, enabling the user to type in the item id, then the results will appear on the main form. The problem is when I try to add a record from that result, or edit that result, I get the message, run-time error -'2147467259 (800004005)': The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship...

I know what the error means, I think, but there is nothing in my code that, I think, would cause this error to happen.

Private Sub cmdAddMovie_Click()

Adodc1.Recordset.MoveFirst

Adodc1.Recordset.AddNew

' There is a lot more code, but this deals
' with the database
End

Private Sub cmdSave_Click()
If txtID.Text <> &quot;&quot; Then
Adodc1.Recordset.Update
end if
' Same as above, a lot more code, but it isn't relavent
End

I can click on the edit button, but when I click on save, I will get the same message.

Also, I noticed when I am already on the record, i.e. record 2, and I type in the ID of record 2, I will not get any error messages. Any suggestions.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top