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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MouseHook on Subforms

Status
Not open for further replies.

jimjaix

MIS
Jan 14, 2011
17
US
Hi, I trying to apply the mousehook function on my database so it doesn't scroll down between records when I use the wheel.

I use the following code and it works on my main form but does not work on subforms. Can someone tell me how to apply this to all my subforms under my mainform?

Private Sub Form_Load()
Dim blRet As Boolean
blRet = MouseWheelOFF(True)
End Sub

MouseHook Function
 
I used this with no problem...

Private Sub Form_Load()
Dim blRet As Boolean
[blRet = MouseWheelOFF(True)]
End Sub

hoof

 
Correction....

I used this with no problem...

Private Sub Form_Load()
Dim blRet As Boolean
blRet = MouseWheelOFF(True, False)

End Sub

hoof
 
Yes I do. I think the dll needs to be in the same folder to function correctly. Lemme check a few other things.
 
You should have in the mod :

Public Function MouseWheelOFF(Optional NoSubFormScroll As Boolean = False, _
Optional GlobalHook As Boolean = False) As Boolean
Dim s As String
Dim blRet As Boolean
Dim AccessThreadID As Long
 
I have the dll in the same folder,

Got this on the mainform
Private Sub Form_Load()Dim blRet As BooleanblRet = MouseWheelOFF(True, False)

and updated the mod to read
Public Function MouseWheelOFF(Optional NoSubFormScroll As Boolean = False, _Optional GlobalHook As Boolean = False) As BooleanDim s As StringDim blRet As BooleanDim AccessThreadID As Long

but it still doesn't work. when I use the scroll wheel on the mouse it will just go to next/previous record. Is there another way to lock the wheel on the mouse?
 
Per Lebans.....

Just copy the included MouseHook.DLL into your Windows/System folder or into the same folder as your application MDB. One instance handles all Forms and SubForms so only call the functions once from a SINGLE Form.

Here is sample code that can be placed behind CommandButton controls. You could also place this code in the Load event of a single Form. Remember you need to call these functions only ONE TIME. The MouseHook will look after the MouseWheel messages for all forms that you have open now or at any time during your current session. Remember to turn the MouseWheel back on before you exit the current session!

My only thought is to double check everything. Sorry I have no more info

hoof
 
Um... it's weird cause the mousehook does work on my main form, but not the tabs subform. I put the code in the Load event, I guess I will double check. pretty sure I got all the stuff down...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top