Setting CurrentRow/Record in a datasheet

Savita

Registered User.
Local time
Today, 09:30
Joined
Sep 1, 2007
Messages
14
Hi,

Is there a way to programatically set the current row in a datasheet(subform) (without clicking the row)?Pls let me know.By default,the first row in the subform gets set as the current row.What do I need to do if I had to set it programatically to, say 4th row?

Thanks,
Savita
 
You can use the .AbsolutePosition property or the .Find or .Move methods of the Recordset property of the form. Code might look like...
Code:
Private Sub MoveToPos(RecNum as long)
  Me.Recordset.AbsolutePosition = RecNum - 1
End Sub

Private Sub MoveOffset(records as long)
  Me.Recordset.Move records
End Sub

Private Sub FindFirst(ParamID as long)
  Me.Recordset.FindFirst "TableID = " & ParamID
End Sub
 

Users who are viewing this thread

Back
Top Bottom