Solved

What is this line of code doing?

Posted on 2014-12-29
3
106 Views
Last Modified: 2014-12-29
I'm working with an old Access 2003 database and on a particular form there is a combobox.  In the afterupdate event of the combobox is this line of code:

If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Can someone tell me what it does?

--Steve
0
Comment
Question by:SteveL13
  • 2
3 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 250 total points
ID: 40521825
A bookmark is a pointer or tag for a given record within a recordset.  It's used to jump back to a specific point in a recordset.

Further on in the code, you'll find a place where it's being used to move back to a record.

Jim.
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
ID: 40521837
Also, it's checking for the recordset's EndOfFile (EOF) before doing that. In English:

If the recordset is not at the end of the file, then move form's bookmark to the recordset's bookmark.
0
 
LVL 57
ID: 40521949
One important point on bookmarks; the values don't survive a requery or anything that causes the recordset to be re-created (a close and open).

They are only valid for the current recordset.  Once you close it or requery it, any saved bookmark values are invalid.

 So it's not something you can save forever.  It's sole purpose is to be able to move back to a given record quickly in a recordset that your currently using.  In using it, you don't need to save a key for the record, then do a find.  That is however what your forced to do if you can't use a bookmark (say because you are doing a requery).

Jim.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

708 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

17 Experts available now in Live!

Get 1:1 Help Now