Solved

Scroll to First Record in the Form

Posted on 2011-09-15
2
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access Query - calculate End of the Month in Query 2 54
SQL Query logic question 14 71
question about a text field with default value 5 31
office 2016 license quastion 3 44
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

734 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