Using the mouse wheel with Access 2002

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.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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...

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.