I have an UNBOUND combo box called cboSubjectID (text format) on a form that I am using to look up existing record. Under AfterUpdate event, I wrote following code to try to do this but does not work.
Private Sub cboSubjectID_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SubjectID] = '" & Me![cboSubjectID] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
' Find the record that matches the control.
End Sub
When I try to save this record, it says "the changes you requested to the table were not successful because they would create duplicate values in the index, primary key or relationship"
Can anyone tell me what I'm doing wrong?
Private Sub cboSubjectID_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SubjectID] = '" & Me![cboSubjectID] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
' Find the record that matches the control.
End Sub
When I try to save this record, it says "the changes you requested to the table were not successful because they would create duplicate values in the index, primary key or relationship"
Can anyone tell me what I'm doing wrong?
Last edited: