Mouse Wheel Code

Geoff Codd

Registered User.
Local time
Today, 02:19
Joined
Mar 6, 2002
Messages
190
I have the following code which is inserted into each form to disable the mouse wheel, the problem I am having is that it works fine for the main form but as soon as it is entered into a subform i get the following problems

1) I can't select any fields using the mouse
2) I get an error on closing the form relating to this clsMouseWheel.SubClassUnHookForm

Any help would be greatly appreciated
Thanks
Geoff

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
 
Someone out there must have a working copy of this code I could have a look at.

Please help me
 
If anyone out there has a database with working code to disable the mousewheel on forms and subforms

Please e-mail it to me

Thanks
Geoff
 
Workaround

Here is something you may want to try. I was having the exact same problem with not being able to access the subform using the mousewheel.dll solution from the MS knowledgebase article. I found that if I leave the sourceobject for the subform blank and assign it explicitly in the open event of the parent form, I can get to the fields in the subform with no problem and the mousewheel stays disabled. So in the open event of your parent form, you'll want to add the following code...

me.<subformcontrolname>.sourceobject = "subformtitle"

You can leave the linkchildfields and linkparentfields intact on the parent form. Also, include all of the load and close event code and the sub from the knowledgebase article. Haven't tested this extensively but it appears to be working.

Good luck!

Jerry
 

Users who are viewing this thread

Back
Top Bottom