Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Move cursor (AXP)

    How do I move the cursor on a datasheet to a specific record when I open it?

    Thanks,
    Mark

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Move cursor (AXP)

    If you mean a table or query in datasheet view, I wouldn't know (or care)

    If you mean a form in datasheet view, you would use the same technique as for a continuous or single form. Say that you want to put the cursor in the record whose ID is equal to the value of the OpenArgs argument.

    Private Sub Form_Load()
    Dim rst As Object
    Set rst = Me.RecordsetClone
    rst.FindFirst "BookID=" & Nz(OpenArgs, 0)
    If rst.NoMatch Then
    Beep
    Else
    Me.Bookmark = rst.Bookmark
    End If
    Set rst = Nothing
    End Sub

    Note: I declared rst as Object instead of as Recordset to be independent of the existence of a reference to ADO or DAO.

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Move cursor (AXP)

    Thanks Hans,
    That works perfectly!

    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •