Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Disabling a mouse wheel


Message #1 by "Morris Tomlinson" <faucault@h...> on Sun, 25 Aug 2002 20:20:58
Hi all,
Thanks to all for previous help - have sorted most problems out.

But now I need to know if I can disable the mouse wheel from within 
Access97. The wheel creates new records on a subform I have. My finger 
slipped and suddenly I had 500 new records! The database I've developed 
for work may be used with wheel enabled mice as the internet will be 
available to some users.

Any thoughs, anyone?
Ta for now
Morris
Message #2 by "Hamilton. Tom" <hamiltont@s...> on Mon, 26 Aug 2002 10:59:47 -0700
Hi Morris,
Unless you want users to be able to create records in the subform you could just set the subforms (Data) attributes to 'Allow
Additions = False".  If you have a 'Add New Record' button then it would just set the 'Allow Additions' to True (then reset it back
to False afterward).  Disabling rodents can have some other problems as a user moves from application to application.  You can get
to the mouse this through an API call, but I wouldn't go that route.
 
-----Original Message----- 
From: Morris Tomlinson [mailto:faucault@h...] 
Sent: Sun 8/25/2002 1:20 PM 
To: Access 
Cc: 
Subject: [access] Disabling a mouse wheel



	Hi all, 
	Thanks to all for previous help - have sorted most problems out. 

	But now I need to know if I can disable the mouse wheel from within 
	Access97. The wheel creates new records on a subform I have. My finger 
	slipped and suddenly I had 500 new records! The database I've developed 
	for work may be used with wheel enabled mice as the internet will be 
	available to some users. 

	Any thoughs, anyone? 
	Ta for now 
	Morris 
	--- 


Message #3 by "Derrick Flores" <Derrick_Flores@s...> on Mon, 26 Aug 2002 13:58:59 -0500
Morris,
   You can go to Microsoft Knowledge Base (Q308636) to find your answer there.  Here's a ActiveX dll file that I made using Visual
Basic 6.  3
1. Copy the library to a place that everyone can see it. Then open the database and go to the form that you want to restrict the use
of the scroll.  
2. Click on View - - > Code to get to the Visual Basic Editor.  
3. Click on Tools - -> ActiveX Controls
4. Click on Register - - > mousewheel.dll in the place that you've saved the dll file - - > then click open.  Click Ok to
close the References dialog box.
3. Click Tools - -> References.  Locate the mousewheel in the available reference list - - > Click Ok to close.

Here's a sample of my code to test the functionality of the dll file.  I created a test database with a dummy table and form. I have
a check box to enable and disable the use of the scroll.

Option Compare Database
Option Explicit

Private WithEvents clsMouseWheel As MouseWheel.CMouseWheel

Private Sub chkUnlockWheelMouse_Click()
If Me.chkUnlockWheelMouse.Value = True Then
    LockWheelMouse
    Me.lblLockWheelMouse.Caption = "UnLock Wheel Mouse To Scroll Thru Records."
Else
    UnlockWheelMouse
    Me.lblLockWheelMouse.Caption = "Lock Wheel Mouse To Prevent Scrolling Thru Records."
End If
End Sub

Private Sub Form_Load()
    LockWheelMouse
    Me.chkUnlockWheelMouse.Value = True
End Sub

Private Sub Form_Close()
    UnlockWheelMouse
End Sub

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

Public Function LockWheelMouse()
    Set clsMouseWheel = New MouseWheel.CMouseWheel
    Set clsMouseWheel.Form = Me
    clsMouseWheel.SubClassHookForm
End Function

Public Function UnlockWheelMouse()
    clsMouseWheel.SubClassUnHookForm
    Set clsMouseWheel.Form = Nothing
    Set clsMouseWheel = Nothing
End Function

Good Luck,
Derrick Flores
Sony Semiconductor
San Antonio, TX

>>> hamiltont@s... 08/26/02 12:59PM >>>
Hi Morris,
Unless you want users to be able to create records in the subform you could just set the subforms (Data) attributes to 'Allow
Additions = False".  If you have a 'Add New Record' button then it would just set the 'Allow Additions' to True (then reset it back
to False afterward).  Disabling rodents can have some other problems as a user moves from application to application.  You can get
to the mouse this through an API call, but I wouldn't go that route.
 
-----Original Message----- 
From: Morris Tomlinson [mailto:faucault@h...] 
Sent: Sun 8/25/2002 1:20 PM 
To: Access 
Cc: 
Subject: [access] Disabling a mouse wheel



	Hi all, 
	Thanks to all for previous help - have sorted most problems out. 

	But now I need to know if I can disable the mouse wheel from within 
	Access97. The wheel creates new records on a subform I have. My finger 
	slipped and suddenly I had 500 new records! The database I've developed 
	for work may be used with wheel enabled mice as the internet will be 
	available to some users. 

	Any thoughs, anyone? 
	Ta for now 
	Morris 
	--- 





Message #4 by "Morris Tomlinson" <faucault@h...> on Wed, 28 Aug 2002 19:26:28
Thanks Tom and Derrick. Because of time limitations I've used Tom's 
suggestion to good effect. I'm just trying to find the best event to 
switch "Allow Additions" back to false.
However, as I'm comparatively new to programming I will definately give 
Derrick's suggestion a go just to keep on climbing up that learning curve 
and to pick up ideas for future projects.

Thanks again 

Morris

  Return to Index