Can't find added new record in recordset

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
 
D

Dan Artuso

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]) & "'"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top