[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Using the mouse wheel with Access 2002

Posted on 2004-12-01
2
Medium Priority
?
223 Views
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.

0
Comment
Question by:ACCESSIBLESOLUTIONS
2 Comments
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 1500 total points
ID: 12717615
0
 
LVL 26

Expert Comment

by:dannywareham
ID: 12717846
De ja vu....

You can also have a look at http://www.mvps.org/access/api/api0036.htm
This can track the wheel, so that you can use it as an event - rather than simply turning it on or off...

:-)
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

834 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