View Full Version : Mouse Wheel Trouble


Soulium
09-23-2008, 02:17 AM
So I am trying to use this MouseHook.dll from http://www.lebans.com/mousewheelonoff.htm (http://www.lebans.com/mousewheelonoff.htm)and am having trouble. I have put the .dll in my database directory (which is on a public folder) and have imported the module from the sample database I have also copied the code for the Mouse Wheel so it’s set to off in the OnLoad Event for the form. Well it’s not working. I have heard that you may need to make a reference to where the .dll file is but I’m not too good with vba - if this is the case could someone tell me where to put the reference in and how the code looks?

Thanks, Matt.

Bodisathva
09-23-2008, 05:03 AM
Dim strPath as String

strPath = "x:\xxxxxx\xxxxxx\xxxx.dll"
Application.References.AddFromFile strFullPath

If someone else is going to run the db, they will also need the .dll referenced by the code (or you will need to appropriately trap and handle the ensuing error).

As another option, you may want to look at VBScroll and run it at startup.

Soulium
09-23-2008, 05:55 AM
Thanks for your help :)

Still not got it working :S Should i put that in the module somewhere?

Sorry for being a bit slow.

Thanks again, Matt.

Bodisathva
09-23-2008, 06:51 AM
Have a switchboard? A main form? Placing this code in the On_Open event of either should do the trick.

If that fails, you could also place the code in a module and use the RunCode command from an AutoExec macro.

Steve R.
09-23-2008, 09:12 AM
It works for me (Access 2000), below is a copy of the "Form_Open" event. All the rest of the code is in a module as a function.

Public Sub Form_Open(Cancel As Integer)
On Error GoTo ERR_FormOpen
Rem MsgBox "Form Open Occured"
Rem Set initial parameters before opening form
Dim blRet As Boolean
blRet = MouseWheelOFF(True, False)
Set CDBS01 = CurrentDb
Set CRST01 = CDBS01.openrecordset("select * from projectnumqry where [status]<10", dbOpenDynaset)
Set Me.Recordset = CRST01
FormNamestr = Me.Name
Set Forms(FormNamestr).Recordset = CRST01
Call SetControlFormat
Call DatabaseColors
[List7].Selected(1) = True
Me.List7.BorderColor = Borderclr
If Application.CommandBars("Menu bar").Enabled Then
Me.Command270.Caption = "Toolbars OFF"
Else
Me.Command270.Caption = "Toolbars ON"
End If
Exit Sub
ERR_FormOpen:
MsgBox Err.Description
Exit Sub
End Sub

Soulium
09-24-2008, 12:43 AM
Ok this is really weird.

I'll open the form and I’ll be able to scroll through the records but as soon as I click a record on the form or change to a different tab it suddenly works. I do have sub forms on this form could they be causing the problem?

Edit:

Its ok. solved the problem by setting a focus up.

Thanks for your help :D You both rock! :D

MaliciousMike
11-25-2008, 07:12 AM
Now I have an issue with this if someone could help.

I have a form with one subform. The mousehook.dll aproach is working and not allowing a user to scroll through records. And on the main form, it is allowing people to scroll through memo text boxes.
However, on my subform, it's not allowing users to scroll in the memo text boxes (there's several...).

I've tried MouseWheelOFF(False), MouseWheelOFF(True) and both the same again in the subform's OnLoad event, however nothing seems to be working.
Is there a known bug with this?

Any help would be greatly appreciated!