Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Mouse Scrolling wont work!

Status
Not open for further replies.

dulla

Technical User
Feb 3, 2003
54
0
0
i have looked at the link and it works great for the sample db. but i can't get it to work in my db. i keep getting the message:

"The expression On Load you entered as the event property setting produced the following error: User-defined type not
defined

*the expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]
*there may have been an error evaluating the function, event, or macro. "

When i close the form, i get the same thing but for the 'On Close' event. here is what i put in the Clients Information form that i have:

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



The rest of the reference code is within the link that was provided:


Why am i getting this error in my code, when it worked in the northwind sample? and i have also accounted for duplicate events when adding the new code. (form load). Any Ideas? Thank you.

Ameen
 
Yes you need to turn on a Reference.
Not sure which one but in the Northwind sample go into the VBA code and click the "Tools" menu then "References"
look at the ones checked
open your db and make the same ones checked


DougP, MCP
 
ok have done this. the only option that my reference is missing is 'Microsoft Office XP Web Components". but i have selected 'microsoft office web components' option instead. other than that everything is matched but still, same problem! what to do?? thanks

ameen
 
ok i got it to work somehow. the main form works fine, but i can't get the subforms to work. if i open the subforms individually they work fine (you can click in the fields and the mouse scroll is disabled). However, when i access the subform from the main form (by opening the main form) the mouse scrolling is disabled, but the fields seem to be locked (i can't place the cursor in them, or press any buttons). Is there any way to disable mouse scrolling for the main form AND the subform? thanks

ameen
 
place the code in the subform. Actually place the code in any form you want this to occur.

PaulF
 
There is a dll & code available from that allows you to do this very easily.
Can't say I've used it, but it's there if you want it.


B

----------------------------------------------
Ben O'Hara

"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------
 
for some reason this code only works in my main form and not my subforms. in my subforms, the scrolling gets disabled, but the form and all the fields/buttons get locked.

Option Explicit

Private WithEvents clsMouseWheel As MouseWheel.CMouseWheel ' 308636

Private Sub clsMouseWheel_MouseWheel(Cancel As Integer)
'// KB 308636 - ACC97 How to Prevent Use of the Mouse Wheel to Scroll Through Records
' Debug.Print "You cannot use the mouse wheel to scroll records."
Cancel = True
End Sub

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

Private Sub Form_Close()
'=zFormClose(form)
On Error GoTo NextCmd
clsMouseWheel.SubClassUnHookForm ' Q308636
Set clsMouseWheel.Form = Nothing
Set clsMouseWheel = Nothing
NextCmd: Err = 0
On Error GoTo 0
Call zFormClose(Form)
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top