Using the mouse wheel with Access 2002

Posted on 2004-12-01
Last Modified: 2012-08-13
We need some help resolving a mouse wheel problem on some of our forms. Currently we are coding to disable it on the BeforeUpdate event of the form but it appears very inconsistent in it's behavior on the forms where it works and with other forms doesn't work at all.

Here is what I'm doing:
1. I created a modular variable in the form called modCancel as Boolean
2. I add this code:
Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
    modCancel = True
End Sub
3. I add this code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
    If modCancel = True Then
        MsgBox "You cannot use the mousewheel to scroll through records. Use PageUp and PageDown.", vbOKOnly + vbInformation
        Cancel = True
        modCancel = False
    End If
End Sub

What this does is when the user scrolls the mouse wheel then the modular variable is set to true and the form beforeupdate automatically fires and the code in there checks to see if the modular variable is true and if so then it sends a message and cancels the event. It also resets the modular variable back to false. This cancels the mouse wheel movement completely with no side effects. I have code behind my key press events to make sure that the PageUp and PageDown don't fail also, but I want the user to be able to use those as a scrolling tool.

The problem is that this works on about half of my data forms and with the other half the form_beforeupdate event doesn't fire until I hit the end of the recordset on the form at the new record (which is a blank record and that is causing the errors that I'm trying to avoid).

Is there a better way of cancelling out the mousewheel event or does anyone know why the beforeupdate events wouldn't be firing? Before you reply know that I've tried the Microsoft KB code and it doesn't work correctly.

    LVL 41

    Accepted Solution

    LVL 26

    Expert Comment

    De ja vu....

    You can also have a look at
    This can track the wheel, so that you can use it as an event - rather than simply turning it on or off...


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
    QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
    Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
    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…

    759 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

    11 Experts available now in Live!

    Get 1:1 Help Now