1

In Access 2007 form if any of my listboxs has a focus, I can;t scroll my form up or down. To do that I have to move the focus to any other control except the listbox, and by the way all of my listboxs have only 4 items on it with no scroll bar, I just need to use my mouse scroll wheel to scroll up or down my whole form even if my listbox has a focus.

I have found the following code that is used to disable the listbox scroll, but I couldn't test it because I can't see any event named (mousewheel) in my listbox events list.

Private Sub ListBox1_MouseWheel(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles ListBox1.MouseWheel
Dim disable As HandledMouseEventArgs = e
disable.Handled = True
End Sub

Also I don't know if that code will force my form to use its scroll instead of the listbox scroll. Any suggestions?

nbanic
  • 1,270
  • 1
  • 8
  • 11
user1921704
  • 179
  • 3
  • 4
  • 15

2 Answers2

2

This is expected behavior. From an MS point of view, they want people using their software (even if it's your software running inside theirs) to get a consistent experience. Access is a bit too primitive to be overriding control behavior. There might be ways you can redesign the form if users are getting lost (personally I hate scrolling forms - I favour a bit of a wizard approach, where the users are asked a small amount of questions at a time and forms for displaying info compartmentalise the info so the user isn't swamped with data).

Makita
  • 726
  • 5
  • 12
0

The idea is remove focus from listbox to a textbox instead.

  1. Place textbox near listbox and format it as follows:

    • Under "Data" tab: Enabled = Yes; Locked = Yes
    • Under "Format" tab: Width = 0

    Textbox must be enabled in order to receive focus. Also "Locked = Yes" should prevent any entry. Now placing it next to listbox serves as a placholder for scrolling when the textbox control receive focus

  2. Next hook a "click" event to Detail. Example:

    Private Sub Detail_Click()
    
        select case(me.ActiveControl.Name)
            case "your list box name":  Me.myDummyTextbox.SetFocus
            '
            ' add more case as needed 
            '
        end select
    End Sub
    
lfurini
  • 3,729
  • 4
  • 30
  • 48
jakwai
  • 1