access recordset.findfirst does not work

Posted on 2012-08-24
Last Modified: 2012-08-24
Hi! I have some VBA that's supposed to find and navigate to a certain record, but it isn't.

Here's the code:
Set rs = Me.RecordsetClone
rs.FindFirst ("commentid = 6241")
Me.Bookmark = rs.Bookmark

Open in new window

But the form stays on the record it's on.

In the immediate window, if I ask ?me.commentid I get  2387, but if I ask ?rs.commentid I get an error: Method or Data Member not Found.

Any ideas?

Question by:etech0
    LVL 6

    Expert Comment

    What's the chance of attaching a scrubbed (clean of personal information) database?
    LVL 119

    Accepted Solution

    Set rs = Me.RecordsetClone

    with rs
        .FindFirst "[commentid] = 6241"
         if  not .nomatch then
              Me.Bookmark = .Bookmark
             msgbox "Record not found!"
         end if
    end with
    LVL 10

    Author Comment

    @capricorn1: Okay, that's the problem - it's not finding it. I don't know why it wasn't finding it - I replaced the code to get the commentID with a valid CommentID, so it should have worked. I back the actual code, and it works now. Thanks!

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now