none
Use the mouse wheel to scroll through records in a form RRS feed

  • General discussion

  • MS Access 2013 Mouse wheel used to move through the records in a form

    © by Robert Kelly and Linken Sauro, all rights reserved in the United States of America and abroad.

    Any user or business may use or modify the following code to help with their applications. We ask that you comment in our copyright or any credit due.

    Program: Microsoft® Office Professional Plus 2013, Access® 2013.

    Access did not have the ability to move through form records with the mouse wheel. Though others have written code to give the programmer or db builder the ability to move through the records, we created this simple code to do the same. This code was created for a single form with may records. It was not tested for any other purpose. We think the builders at MS should have either left the ability to scroll through the forms records with the mouse wheel in, or give a check box in Options/Client Settings/Mouse Wheel Movement/Check box for active, for those of us who still want the ability.

    “Me.” Denotes the name of the current form.

    “By Bal Count As Long” is the movement of the mouse wheel, positive number for the next record,

    negative number for the previous record.

    Private Sub Form_MouseWheel(ByBal Page As Boolean, ByVal Count As Long)

    ‘If the mouse rolls back and you are not on the first record

    ‘you will go to the previous record.

    If (Count < 0) And (Me.CurrentRecord > 1) Then

                                  DoCmd.GoToRecord , , acPrevious

                                  Exit Sub

    End If

    ‘If you’re moving forward in the record set, and as long as you are not on the last record,

    ‘then you will move to the next record.

    If (Count > 0) Snd (Me.CurrentRecord < Me.Recordset.RecordCount) Then

                                  DoCmd.GoToRecord , , acNext

                                  Exit Sub

    End If

    ‘Based upon the above code, if you are trying to go to the previous record and you are on

    ‘the first record, nothing is done.

    ‘And the same when you are on the last record and want to go to the next record, nothing

    ‘will happen.

    End Sub

    Comments to the programmers can be addressed to: linkentrade at gmail com or rlkelly at gmail com - sorry about the cryptic email, the post wouldn't allow me to post links.

    Please place the following text in the subject line: VBA Code, Mouse Wheel

    Thursday, March 31, 2016 6:35 AM