Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Feb 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Scroll thru combo (A2000)

    I need to scroll thru a combo's rowsource.

    The way I want it to work is, when the combo has the focus, the user can use the left & right keys to scroll thru.

    I don't know what the syntax would be for the key down event.

    If Keycode = 37 Then ????????????????????????????????


    Dave

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Scroll thru combo (A2000)

    <pre>Private Sub cmbZoekNr_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 37 Then
    If Me.cmbZoekNr.ListIndex > 0 Then
    Me!cmbZoekNr.ListIndex = Me!cmbZoekNr.ListIndex - 1
    End If
    End If
    If KeyCode = 39 Then
    If Me.cmbZoekNr.ListIndex < Me.cmbZoekNr.ListCount - 1 Then
    Me!cmbZoekNr.ListIndex = Me!cmbZoekNr.ListIndex + 1
    End If
    End If
    End Sub
    </pre>

    This code suppose that your combo is named cmbZoekNr
    Francois

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Scroll thru combo (A2000)

    Why are you using the Left/Right keys, when the Up/Down keys already do this?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    Star Lounger
    Join Date
    Feb 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Scroll thru combo (A2000)

    The code from Francois works ok.

    The Up/Down L/R keys dont scroll thru the list only move the focus to the next tab stop item.

    Thanks any way
    Dave

  5. #5
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Scroll thru combo (A2000)

    The Up/Down keys will move thru the list if you have opened the combo box. In you combo box's OnEnter event, include this line of code to automatically open the dropdown list:

    yourControlNameHere.Dropdown
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  6. #6
    Star Lounger
    Join Date
    Feb 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Scroll thru combo (A2000)

    Thanks for that Mark, I have uses for both solutions.
    See yah later

    Dave

Posting Permissions

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