Change the On Mouse Wheel event

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

Guest

Rather than have the form change records when I use the mouse wheel, I'd like
to have a listbox that's already been populated with values to just scroll up
or down. I can't imagine this should be too hard but I'm too much of a newb
to know how to do it. Many thanks.
 
If the listbox already has the focus, the mouse wheel should scroll it. If it
doesn't you can trap the OnMouseWheel event and set the focus.

In the form's OnMouseWheel event, click the elipsis (...) to the right and
go to the Code Builder. Insert this code in the MouseWheel event:

Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
Me.MyListBox.SetFocus ' <---Insert this line of code
End Sub

Replace MyListBox with the actual name of your listbox. This will set the
focus to the listbox as soon as the form detects a wheel movement.

Barry
 

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


Back
Top