maintaining record position after a requery

tanzania

Registered User.
Local time
Today, 05:07
Joined
Oct 20, 2006
Messages
91
I have a subform that displays a list of records based on a filter. I have a checkbox control that when ticked, I want to requery the form to orderby this control. This all works fine, however I want some way of maintaining the focus at the position where this occured(the next record after the one that just had its box checked). I had a look at doing the following, but this goes to the next record for all and not based on the records in the applied filer. Any ideas appreciated!!

rs.FindFirst ("[Event_No] = " & Me.Event_No)
rs.MoveNext
rs.Edit
rs![ClosedTrack] = True 'set a record flag to true to search for after query
rs.Update

Me.Requery

rs.FindFirst ("[Event_No] = " & Me.Event_No)
rs.Edit
rs![ClosedTrack] = False
rs.Update
 
Do it like this:

Code:
    Dim strBookMark As String
    
    strBookMark = Me.Recordset.Bookmark
    Me.Requery
    Me.Recordset.Bookmark = strBookMark
 
fantastically simple! thanxs :-)
 
GladWeCouldHelp.png
 
Ok so i just found a small glitch in what otherwise works great. On the first instance of checking a box after the form has been opened I get the following msg "Not a valid bookmark" error 3159. Then anytime I check a box after that it works fine...until the next close and open of the form. Do you know what is causing this error?
 

Users who are viewing this thread

Back
Top Bottom