Can't find added new record in recordset

  • Thread starter Thread starter EN Coleman
  • Start date Start date
E

EN Coleman

After adding a new record, the record can be moved to by
using commands like DoCmd.GoToRecord , , acNext but when
using the following to move to the record:

Set rs = Me.Recordset.Clone
rs.FindFirst "[CaseID] = " & Str(Me![FindBySSN])
If rs.NoMatch Then
MsgBox "Record not found...", vbOKOnly
[FindBySSN] = [CaseID]
[FindByName] = [CaseID]
Else
' move to selected item
Me.Bookmark = rs.Bookmark
End If

the record is not found in the recordset even though the
FindBySSN value is correct. If a subsequent update is
performed on the record then the record will be found with
the same above code.

Does anyone have an idea what prevents the new record from
being found after insert even though it can be navigated
to?

Thanks in advance for any help,
ENC
 
Hi,
I notice you're using Str() to return a string which must mean your CaseID is
in fact a string. Correct?
If so, you should delimit the criteria with single quotes:

rs.FindFirst "[CaseID] = '" & Str(Me![FindBySSN]) & "'"
 
Back
Top