Listbox Scroll behaviour ?

  • Thread starter Thread starter Rob Hofkens
  • Start date Start date
R

Rob Hofkens

Hi everyone,

I use a listbox (Access 2003) with many values in it and I find the vertical
scrollbar behaves a bit weird.
When I scroll down with the slider and reach the bottom I notice that the
list isn't at bottom at all.
I need to redo this scrolling a few times until it's finaly at the end of
the list.
When that happends the scroll bar seems to be ok.

Any idea what I can do about this ?

Thanx in advance.

Rob.
 
Try putting this in the OnEnter event:

Private Sub List1_Enter()
Dim Junk As Long
Junk = Me.List1.ListCount
End Sub

...using your ListBox name of course!
The goal is to force the ListBox to load the entire RecordSet.
 
There is no need to place the code in the Enter event for the control as it
will be called each time the user sets focus to the control. It would be
better to place the code in the Form's Load event.

Just my $.02
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Good point Stephan. Thanks for pointing that out.

Stephen said:
There is no need to place the code in the Enter event for the control as it
will be called each time the user sets focus to the control. It would be
better to place the code in the Form's Load event.

Just my $.02
Try putting this in the OnEnter event:
[quoted text clipped - 22 lines]
 
Thank you Ruralguy and Stephen for your replies :)

I knew about this solution and used the code before I asked my question
here.
I used this code in Access 2000 and there it worked but now we upgraded to
Access 2003 it seems not to work anymore.
So, I hoped that this was a common problem with Access 2003 and that there
was another solution.

I don't know it matters but I use the listbox to show a list of names of
customers.
This list can be up to 3000 names long but 99% of the time there is a filter
active in the form of a SQL that I use for the listbox.rowsource.
So most of the time there are arround max 300-400 names depending on the
users input.
After I set the listbox.rowsource with the SQL I set the CoumnCount and
CoulmnWidths like this

Me![lstName].RowSource = strSQL
Me![lstName].ColumnCount = 5
Me![lstName].ColumnWidths = "0cm; 2,5cm; 8,5cm; 6cm; 4cm;"

After this I use the solution you both mention here:

lngListTotal = Me.lstName.ListCount

When I recall correctly this used to work in Access 2000 but not now ?

Rob.
 
I'm sorry Rob but I only have acXP (2002). I have not heard of that
particular problem with ac2003, but who knows. Maybe someone with ac2k3 can
jump in and test it.

Rob said:
Thank you Ruralguy and Stephen for your replies :)

I knew about this solution and used the code before I asked my question
here.
I used this code in Access 2000 and there it worked but now we upgraded to
Access 2003 it seems not to work anymore.
So, I hoped that this was a common problem with Access 2003 and that there
was another solution.

I don't know it matters but I use the listbox to show a list of names of
customers.
This list can be up to 3000 names long but 99% of the time there is a filter
active in the form of a SQL that I use for the listbox.rowsource.
So most of the time there are arround max 300-400 names depending on the
users input.
After I set the listbox.rowsource with the SQL I set the CoumnCount and
CoulmnWidths like this

Me![lstName].RowSource = strSQL
Me![lstName].ColumnCount = 5
Me![lstName].ColumnWidths = "0cm; 2,5cm; 8,5cm; 6cm; 4cm;"

After this I use the solution you both mention here:

lngListTotal = Me.lstName.ListCount

When I recall correctly this used to work in Access 2000 but not now ?

Rob.
There is no need to place the code in the Enter event for the control as
it will be called each time the user sets focus to the control. It would
[quoted text clipped - 27 lines]
 
Thanks for helping out anyway :)

Rob.

ruralguy via AccessMonster.com said:
I'm sorry Rob but I only have acXP (2002). I have not heard of that
particular problem with ac2003, but who knows. Maybe someone with ac2k3
can
jump in and test it.

Rob said:
Thank you Ruralguy and Stephen for your replies :)

I knew about this solution and used the code before I asked my question
here.
I used this code in Access 2000 and there it worked but now we upgraded to
Access 2003 it seems not to work anymore.
So, I hoped that this was a common problem with Access 2003 and that there
was another solution.

I don't know it matters but I use the listbox to show a list of names of
customers.
This list can be up to 3000 names long but 99% of the time there is a
filter
active in the form of a SQL that I use for the listbox.rowsource.
So most of the time there are arround max 300-400 names depending on the
users input.
After I set the listbox.rowsource with the SQL I set the CoumnCount and
CoulmnWidths like this

Me![lstName].RowSource = strSQL
Me![lstName].ColumnCount = 5
Me![lstName].ColumnWidths = "0cm; 2,5cm; 8,5cm; 6cm; 4cm;"

After this I use the solution you both mention here:

lngListTotal = Me.lstName.ListCount

When I recall correctly this used to work in Access 2000 but not now ?

Rob.
There is no need to place the code in the Enter event for the control as
it will be called each time the user sets focus to the control. It would
[quoted text clipped - 27 lines]
 
Back
Top