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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0
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,
 
Upvote 0
Can't you just change the form's Cycle property to Current Record?
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,998
Members
448,541
Latest member
iparraguirre89

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
Back
Top