Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    List Box Scrolling (2003 SP2)

    I have a list box on a form that permits selection of a record from a table. Upon opening the form and clicking in the box it shows a partial list of the records with a scroll bar. However, I cannot drag the slider and have it smoothly scroll though the list. I can drag the slider down and let go and it will go to that part of the list. BUT, if I first move the slider all the way to the bottom of the list, then I can easily scroll the entire list using the slider. I would like this latter action to take place when I first open the list. Any suggestions?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: List Box Scrolling (2003 SP2)

    For efficiency reasons, Access doesn't load the entire list when the form is opened, so the scroll bar doesn't "know" yet how long the list is. You can force the list to be loaded in its entirety using a bit of code. This may cause a slight delay in opening the form:
    <code>
    Private Sub Form_Load()
    With Me.ListBoxName
    .Value = .ItemData(.ListCount - 1)
    .Value = .ItemData(0)
    End With
    End Sub
    </code>
    Substitute the name of your list box.

  3. #3
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: List Box Scrolling (2003 SP2)

    Thanks Hans,

    That did the trick.

Posting Permissions

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