Access MVP (2010-2015)

oOo.oOo.oOo.oOo.oOo.oOo

Maintain Record Position After Update

When updating a record on a Continuous Form it has a tendency to scroll back up to the top.  For End Users this can be problematic as they have now lost their place and have to scroll down to find it.  Here’s two slightly different Function to prevent that…

This one will cause the record to float to the top of the Form but the scrollbar maintains its position…

Function fRequeryPlus(frm As Form)
'To use fRequeryPlus Me
    Dim intRecordID As Integer

    intRecordID = frm.CurrentRecord
    frm.Requery
    DoCmd.GoToRecord , , acGoTo, intRecordID

End Function

 

This one will keep record and scrollbar position intact…

Function fRefreshPlus(frm As Form)
'To use fRefreshPlus Me
    Dim intRecordID As Integer

    intRecordID = frm.CurrentRecord
    frm.Refresh
    DoCmd.GoToRecord , , acGoTo, intRecordID

End Function

Note, if you are deleting a record then only fRequeryPlus() will work UNLESS you only mark the record for deletion and delete upon closing the Form, in that case you can use fRefreshPlus(). Other than that you will see #DELETED in the controls for that record.

 933 total views,  1 views today

Comments are closed.