[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Set rs = Me.Recordset.Clone

Posted on 2004-11-08
5
Medium Priority
?
1,321 Views
Last Modified: 2008-03-17
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
0
Comment
Question by:mafle
  • 3
  • 2
5 Comments
 
LVL 34

Expert Comment

by:flavo
ID: 12527701
try

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

Dave
0
 
LVL 34

Accepted Solution

by:
flavo earned 300 total points
ID: 12527720
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
 

Author Comment

by:mafle
ID: 12527805
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
 

Author Comment

by:mafle
ID: 12527901
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
 
LVL 34

Expert Comment

by:flavo
ID: 12527905
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

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question