The following code works fine until I set the bookmark, and I get the run-time error: 2108 - You must save the field before you execute the GoToControl, or setfocus method. Then it goes to the record if it exists. Can someone help me get rid of this error? Thanks very much for your help!!! Karen
Private Sub PatientID_BeforeUpdate(Cancel As Integer)
Dim rst As DAO.Recordset
Dim strSearch As String
Set rst = Me.RecordsetClone
strSearch = "[Patient ID] = """ & Forms!FrmPatientDetail![Patient ID] & """"
rst.FindFirst strSearch
If rst.NoMatch Then
Exit Sub
Else
Me.Undo
Me.Bookmark = rst.Bookmark
End If
rst.Close
End Sub
Private Sub PatientID_BeforeUpdate(Cancel As Integer)
Dim rst As DAO.Recordset
Dim strSearch As String
Set rst = Me.RecordsetClone
strSearch = "[Patient ID] = """ & Forms!FrmPatientDetail![Patient ID] & """"
rst.FindFirst strSearch
If rst.NoMatch Then
Exit Sub
Else
Me.Undo
Me.Bookmark = rst.Bookmark
End If
rst.Close
End Sub