Inactivate wheel button (Z) on mouse in Access 2003 form

mssegal

New Member
Joined
Sep 29, 2006
Messages
3
Good Afternoon.

I would like to inactivate the mouse wheel (Z) so my internal users of the database do not scroll through all the records in the database with the mouse wheel (Z) during data entry. What do I do to "disable" the mouse button when using a specific form in Access 2003?

Thanks for your help,

Mike
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Andrew Fergus

MrExcel MVP
Joined
Sep 9, 2004
Messages
5,432
Hi Mike and welcome to MrExcel!

Download the 'Mousewheel.dll' from my webpage here :
http://www.bizequip.co.nz/shares.htm#8

1. Open your form in Design view.
2. Click menu option View > Code to open the Visual Basic Editor.
3. Click menu option Tools > References > Browse > find and click MouseWheel.dll > Open.
4. Click OK to close the References dialog box.
5. Add the following code to the module of the form:

Code:
Option Compare Database
Option Explicit

Private WithEvents clsMouseWheel As MouseWheel.CMouseWheel

Private Sub Form_Load()
    Set clsMouseWheel = New MouseWheel.CMouseWheel
    Set clsMouseWheel.Form = Me
    clsMouseWheel.SubClassHookForm
End Sub

Private Sub Form_Close()
   clsMouseWheel.SubClassUnHookForm
   Set clsMouseWheel.Form = Nothing
   Set clsMouseWheel = Nothing
End Sub

Private Sub clsMouseWheel_MouseWheel(Cancel As Integer)
    MsgBox "You cannot use the mouse wheel to scroll records."
    Cancel = True
End Sub

Save and close the Visual Basic Editor. Save and close the form. Re-open the form and you won't be able to use the scroll wheel on that form.

HTH, Andrew
 

mssegal

New Member
Joined
Sep 29, 2006
Messages
3
Thanks for providing the VB code to disable the mouse wheel

Andrew,

Thanks for your help! Would you happen to know how to disable the mouse wheel using the Object Oriented functions of Access2003? If not, I will happily use the code.

Sincerely,

Mike
 

Andrew Fergus

MrExcel MVP
Joined
Sep 9, 2004
Messages
5,432
Hi Mike

As far as I am aware, it is only possible with code (or a wheel-less mouse) and you are limited to two choices. Either use the dll file & code above or code the entire process using VBA (without a dll). The pure VBA solution (without the dll) is prone to problems where the form is not shut down correctly - the mouse wheel then stops working on other forms. The dll method is the safer of the two.

Andrew
 

mssegal

New Member
Joined
Sep 29, 2006
Messages
3

ADVERTISEMENT

Thanks!

Andrew,

Thanks for your dedicated time to my question.

I will give the VB a shot or remove the mousewheels from the workstations at the office :wink:

Thanks again,
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
Can't you just change the form's Cycle property to Current Record?
 

Philem

Active Member
Joined
Jan 2, 2003
Messages
282
Norie, that doesn't work as it seems the MouseWheel event drives thru that setting. At least it does on my system, when I was trying to do something similar to the OP.

-P
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
Philem

Works for me.:eek:

Wait a minute, I just tried it again and it doesn't work.:oops:

Could've sworn it worked yesterday.
 

Forum statistics

Threads
1,136,503
Messages
5,676,230
Members
419,615
Latest member
jda2000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top