How to make subform scroll upwards after setting bookmark?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PeteCresswell

    How to make subform scroll upwards after setting bookmark?

    I'm doing the bookmark thing to force the current record in a subform
    and it works....almost .

    Problem is that the subform then scrolls so that the newly-selected
    field is at the very top of the form. We don't want that. Instead,
    we want the from to be scrolled to the very top (there are a limited
    number of rows...so there's no problem with the newly-selected row
    being somewhere off the bottom of the form).

    Anybody done this?

    Existing Code:
    -----------------------------------------
    Public Sub FieldLocate(ByV al theFieldName As String)
    debugStackPush Me.Name & ": FieldLocate"
    On Error GoTo FieldLocate_err

    ' PURPOSE: To enable us to keep focus on the same row as user moves
    from
    ' Cusip to Cusip or as we pop the Zoom screen and return
    focus
    ' to this screen

    Dim myRS As DAO.Recordset
    Dim myBookMark As Variant

    Set myRS = Me.RecordsetClo ne
    With myRS
    .FindFirst "FieldName= '" & theFieldName & "'"
    If Not .NoMatch = True Then
    myBookMark = .Bookmark
    Me.Bookmark = myBookMark
    End If
    End With

    FieldLocate_xit :
    debugStackPop
    On Error Resume Next
    myRS.Close
    Set myRS = Nothing
    Exit Sub

    FieldLocate_err :
    bugAlert True, ""
    Resume FieldLocate_xit
    End Sub
    -----------------------------------------
Working...