Link to home
Start Free TrialLog in
Avatar of StampIT
StampITFlag for United States of America

asked on

Scroll to First Record in the Form

I use a form to update attendance records. When the records are complete for the day I have a button that appends these records to a table. The scroll bar after the last record is complete is at the bottom of the form on one of the last few records. What code can I add to the button that performs the append to set the scroll bar position at the first record? When I open the form the scroll bar is always on the first record. After I click the button the scroll bar stays on the last few records. Code for the "On Click" property of the button is attached. Thanks
Private Sub cmdqraAttendance_Click()
On Error GoTo Err_cmdqraAttendance_Click

    Dim stDocName As String
    Dim AttDate As Date
    
    Me.Refresh
    
    'Turn Hourglass On
    DoCmd.Hourglass True
    'Turn Warnings Off
    DoCmd.SetWarnings False

    'Append records to tblAttendance
    stDocName = "qraAttendance"
    DoCmd.OpenQuery stDocName, acNormal, acEdit
    'Clear tblEmployees
    stDocName = "qrupdEmployees"
    DoCmd.OpenQuery stDocName, acNormal, acEdit
    
    AttDate = Me.txtAttDate + 1
    Me.txtAttDate = AttDate
    
    MsgBox "Attendance Updated"
    
    'Turn Hourglass Off
    DoCmd.Hourglass False
    'Turn Warnings On
    DoCmd.SetWarnings True
    
    Me.SetFocus

Exit_cmdqraAttendance_Click:
    Exit Sub

Err_cmdqraAttendance_Click:
    MsgBox Err.Description
    Resume Exit_cmdqraAttendance_Click
    
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of StampIT

ASKER

Thanks for the quick and accurate response.