Set rs = Me.Recordset.Clone

Hello experts,

I,m using this code to search a record. but it isn't working

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Nom] = " & str(Me![Modifiable22])
    Me.Bookmark = rs.Bookmark

[nom] is a text field. i know th eproblem is with the string but can't write it correctly.

thanks

mafle
mafleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

flavoCommented:
try

rs.FindFirst "[Nom] = '" & str(Me![Modifiable22]) & "'"

Dave
0
flavoCommented:
i supose i better try exaplain

You need to "wrap" text strings in " or '   (ie  "myString" or 'myString' )
You need to "wrap" dates in #  (ie #01/01/2004# )
Numeric fields dont get "wrapped"

Does this explain it a little better???
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mafleAuthor Commented:
i knew about the date but now it's a litthe clearer.

i tried your wrapped version but it didn't work.

   Set rs = Me.Recordset.Clone
    rs.FindFirst "[Nom] =  '" & str(Me![Modifiable22]) & "'"
    Me.Bookmark = rs.Bookmark


Error 13
type incomptability
0
mafleAuthor Commented:
got it now.

Private Sub Modifiable22_AfterUpdate()

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[NOM] =  '" & Me![Modifiable22] & "'"
    Me.Bookmark = rs.Bookmark
End Sub


i removed the str. thanks for your help.
0
flavoCommented:
I only have A97, but this seemed to work in my test

    Dim rs As DAO.Recordset
    Set rs = Me.RecordsetClone
    rs.FindFirst "[myField] =  '" & testValue & "'"
    Me.Bookmark = rs.Bookmark

so in your example

    Dim rs As DAO.Recordset
    Set rs = Me.RecordsetClone
    rs.FindFirst "[Nom] =  '" & cStr(Me![Modifiable22]) & "'"
    Me.Bookmark = rs.Bookmark
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.