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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

832 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