Solved

Scroll to First Record in the Form

Posted on 2011-09-15
2
255 Views
Last Modified: 2012-05-12
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

0
Comment
Question by:StampIT
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 36542903


  MsgBox "Attendance Updated"


docmd.GoToRecord ,,acFirst     'add this line


0
 

Author Closing Comment

by:StampIT
ID: 36543182
Thanks for the quick and accurate response.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question