Listbox Vertical Scroll Bar Behaviour

G

Guest

I am using a multi-select listbox to show the results from a query in my
application. This is done like:

listbox.RowSource = strSQL
listbox.Requery

when I get a result-set that has more rows than ehat fits my listbox I get a
vertical scroll-bar. The problem occurs when the user clicks on or drags the
scroll-bar. The scroll bar doesn't seem to know how many entries there are in
the list resulting in a "jumping" behaviur, for example if the user drags the
"elevator icon" of the scroll bar to the bottom it will typically jump up to
the middle of the bar. Repeating the dragging action will slowly get the
"elevator" icon lower. Once the user reached the bottom of the scroll-bar the
problems are gone and the scroll bar seems to be working perfectly. Calling
requery again makes the problem return.

Anyone knows how to get around this problem?

Thanks
/Rikard
 
S

Stephen Lebans

First of all you do not need to call the control's Requery method as
setting the RowSource property will naturally force a requery.

As to your second issue here is a previous post on mine on this subject.
It applies equally to List and Combo controls.

A quick search on GoogleGroups can be a valuable timesaver.
From: Stephen Lebans ([email protected])
Subject: Re: Combo scrolling
View this article only
Newsgroups: microsoft.public.access.formsc­oding
Date: 2001-12-19 10:08:48 PST


As John mentioned, it is a case of the Access GUI not knowing how many
rows will be returned by the Rowsource behind the control. To correct
this behaviour we need the force Access to evaluate the total number of
rows generated by the rowsource and then update the ScrollBar's
properties.


In the Form's Load event do something like this:
Dim lngCount as long
lngCount = Me.YourComboName.ListCount




--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

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

Top