Mouse Scrolling

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

OK, I have used the code from Steve Lebans (did i get that right?), works a
treat!!

Now I have the same issue with the "Page Up" & "Page Down" buttons.

I just need to stop any scrolling of records when a new has been added.

Many thanks

Scott
Isca Comps
 
In the forms event properties,

set KeyPreview to YES

then create an OnKeyDown event. In the event, test the value of KeyCode for
page up or page down (you'll have to look up the ASCII values). If you find
that the key press is either a page up or a page down, set the KeyCode = 0.
That converts the ASCII of the keypress to 0, which is the same as nothing
was pressed, so it won't do go to the next record or previous record.
 
Add the code below to your form's On Key Down event:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 33, 34
'If KeyCode is PAGEUP or PAGEDOWN then nullify them
KeyCode = 0
End Select
End Sub

-Ed
 
Ed, this works for pressing keys. Is there something similar I can use to
prevent the same thing happening when using the scroll wheel on a mouse?
 
Back
Top