mouse wheel onoff

D

Dave

I have been testing the solution found here:
http://www.lebans.com/mousewheelonoff.htm

The problem I am having is that it does not work on Forms in a SubForm
object.

My application has a main form and all other forms are opened within a
Subform. Placing the suggested code on the load event of the sub forms
will work if they are oppened directly, but if they are opened in the
sub form object they still respond to the scroll wheel.. I have also
tried placing the code on the onLoad of the parent form but that also
does not stop the scroll wheel form working on the sub forms.

At this point I would be happy to have a solution that stops scroll
wheel function across the whole MDB when it is runing as long as it is
stable.
 
S

Stephen Lebans

It does work with Subforms. The current functionality is what was
requested by the majority of users but I have created a new version that
shuts off the MouseWHeel for Subforms completely. Go to my web site,
leave me feedback on this issue with your Email address and I will send
you the new version of the DLL.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
D

DebbieG

This works for me in Access XP. This works in Single Form, not Continuous
Forms.

HTH,
Debbie


Add a Text Box on your form:

Name = NoMouseWheel
Default Value = " "
Validation Rule = WheelSpin() = False
Validation Text = You can't change records using your mouse wheel. (this can
be left out if you don't want a message)
Visible = Yes
Enabled = Yes
Locked = No
Tab Stop = No
Back style = Transparent
Back Color = -2147483633 (or whatever color your form is)
Special Effect = Flat
Border style = Transparent

FORM EVENTS:

On Mouse Wheel: [Event Procedure]
----------------------------------------------------------------------------------
Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
On Error GoTo GotError
mWheel = True
ValidationTrigger = TheWheel
Me.NoMouseWheel.SetFocus
Me.NoMouseWheel.Text = " "

ExitSub:
ValidationTrigger = NotTheWheel
Exit Sub

GotError:
MsgBox Err.Number & vbCrLf & Err.Description
Resume ExitSub
End Sub
----------------------------------------------------------------------------------

On Error: [Event Procedure]
----------------------------------------------------------------------------------
Private Sub Form_Error(DataErr As Integer, Response As Integer)
' MsgBox DataErr

If Screen.ActiveControl.Name = "NoMouseWheel" Then
Response = acDataErrContinue
End If
End Sub
----------------------------------------------------------------------------------

ADD THIS CODE BEHIND YOUR FORM:
----------------------------------------------------------------------------------
Option Compare Database
Option Explicit

'This Enum is for clarifying the code
Private Enum wsTrigger
TheWheel = 1
NotTheWheel = 2
End Enum

Private mWheel As Boolean
Private ValidationTrigger As wsTrigger

Private Function WheelSpin() As Integer
'used in NoMouseWheel text box on form
WheelSpin = mWheel
Select Case ValidationTrigger
Case NotTheWheel
mWheel = False
End Select
End Function
----------------------------------------------------------------------------------



|I have been testing the solution found here:
| http://www.lebans.com/mousewheelonoff.htm
|
| The problem I am having is that it does not work on Forms in a SubForm
| object.
|
| My application has a main form and all other forms are opened within a
| Subform. Placing the suggested code on the load event of the sub forms
| will work if they are oppened directly, but if they are opened in the
| sub form object they still respond to the scroll wheel.. I have also
| tried placing the code on the onLoad of the parent form but that also
| does not stop the scroll wheel form working on the sub forms.
|
| At this point I would be happy to have a solution that stops scroll
| wheel function across the whole MDB when it is runing as long as it is
| stable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top