I want to share something I've discovered completely by chance that helps to answer a question I've seen asked on various forums but never seen answered. I realise I may be reinventing the wheel here.
The question is whether it's possible to use the vertical scrollbar on a continuous form to select records, so the uppermost record is always the current record. By default, the vertical scrollbar on a continuous form scrolls through the records in a sense, but it doesn't change which record is the current record, and it doesn't change which records are visible on the screen until the first or last visible record has been passed.
The chance discovery is that during screen painting, the form's bookmark becomes out of sync with the recordset's bookmark, because the form's bookmark changes as each row is painted. This means that when the current record leaves the first row through scrolling (.CurrentSectionTop > 0), you can sync the bookmarks (.Recordset.Bookmark = .Bookmark), and then use a well known method to calculate how many records to move through the recordset to make the uppermost record the current record (.Recordset.Move -Round(.CurrentSectionTop / .Section(acDetail).Height).
Here's the code snippet:
I've attached an example that illustrates how this might be used in a master/parent navigation form.Code:Private Sub Detail_Paint() If Me.CurrentSectionTop > 0 Then Me.Recordset.Bookmark = Me.Bookmark Me.Recordset.Move -Round(Me.CurrentSectionTop / Me.Section(acDetail).Height) End If End Sub