Solved

Scroll to First Record in the Form

Posted on 2011-09-15
2
251 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 119

Accepted Solution

by:
Rey Obrero 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now