Recordset bookmarks

Posted on 2013-10-30
Last Modified: 2013-11-01
This code doesn't seem change the bookmark value.  I can't tell why not.
    Dim State_rst As DAO.Recordset
    Dim lngCountOfSourceItems As Long
    Dim lngOriginatingRecord As Long           ' will be a recordset bookmark
    Dim i As Integer ' my record counter index

    Set State_rst = CurrentDb.OpenRecordset("tblStates", dbOpenDynaset)
    State_rst.MoveLast           'Makes sure count below is correct
    Let lngCountOfSourceItems = State_rst.RecordCount
    State_rst.MoveFirst          ' Make sure to start at beginning
    For i = 1 To lngCountOfSourceItems
        Let lngOriginatingRecord = State_rst.Bookmark 
        << do something >>

Open in new window

Question by:DrftrBob
  • 3
LVL 75

Accepted Solution

DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 39612867
Dim lngOriginatingRecord As Variant' will be a recordset bookmark


Let lngCountOfSourceItems = State_rst.RecordCount


lngCountOfSourceItems = State_rst.RecordCount

You don't need or want Let.


Author Comment

ID: 39612893
If I may ask a silly question, what type of data is a bookmark?  If silly, I can accept that.  I suppose debug.print won't display the data properly.  My watched variable seems to be an array now.  Dang - it's late.
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 39612907
"what type of data is a bookmark"
Variant (binary string)
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 39612910
"Bookmark: A property of a Recordset object or a form that contains a binary string identifying the current record.) that uniquely identifies the current record (current record: The record in a recordset that you can modify or retrieve data from. There is only one current record in a recordset, but a recordset may have no current record, for example, after a record has been deleted from a dynaset-type recordset.) in a Recordset object.

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

705 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

18 Experts available now in Live!

Get 1:1 Help Now