Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Unanswered: controlling the scroll

    Is there an easy way to control the scroll on the mouse? Instead of it scrolling through the records on the form, I'd like it to scroll the records in a listbox on the form.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I've only ever disabled the scroll - but I suppose if you can disable it then you can get it to do something else for you instead!

    I'll see if I can dig up the old app I wrote that did this and get back to you
    George
    Home | Blog

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    What version of Access are you using?
    George
    Home | Blog

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Here's the general idea... (using the form mousewheel event - a listbox doesn't have one!!)
    Code:
    Private Sub Form_MouseWheel(ByVal Page As Boolean, ByVal Count As Long)
    
    Dim SelectedIndex As Integer
        
        SelectedIndex = Me.MyListBox.Value
    
        If Not IsNull(SelectedIndex) Then
            If Count >= 0 Then 'forward
                Me.MyListBox.Value = SelectedIndex + 1
            Else
                Me.MyListBox.Value = SelectedIndex - 1
            End If
        End If
    
    End Sub
    EDIT: The If Not IsNull line also needs some tweaking
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •