Select a specific record in datasheet view

  • Thread starter Thread starter AMohabir
  • Start date Start date
A

AMohabir

How can I select a specific record in a subform in datasheet view? - and
keep it selected.

I have a subform that users use to move records up and down for a custom
order but when subform is requeried, its too easy to lose the selected
records place. A different record is actually selected. Selected records
position stays the same.

In other words if i select the 4th record and want it to be the 3rd record,
I press a "Move Up" button which switches the position of the 3rd and 4th
records. When the subform is requeried, positions 4s record is not the
selected record. I need it to be the 3rd record that is selected.
 
AMohabir,

Hard to be precise without knowing more detail about what's going on
with the form. But I assume the sort order change is the result of
editing the value of data in a field which is used as the basis of the
sorting? If so, let's suppose this field is called SortField, and that
it's a number, you can add code along these (air code) lines to the
sort-change procedure...
Dim CurrentSorter As Long
Dim rst As DAO.Recordset
CurrentSorter = Me.SortField
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "SortField =" & CurrentSorter
Me.Bookmark = rst.Bookmark
Set rst = Nothing
 
Back
Top