By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,679 Members | 2,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,679 IT Pros & Developers. It's quick & easy.

Access 2003 Listbox scrollbar -- won't appear

P: n/a
Hello world:

I have a Parent form with a combobox, where the user selects a Contract or
Estimate number.
Then, on a subform, I have a listbox that gets filled with the details of
the selected Contract.
The subform listbox shows 21 rows.
That has been fine, but now we are starting to get some Contracts or
Estimates with more than 21 items.

When there are more than 21 items, no scrollbar shows up on the right side
of the listbox.
Users can't get to item 22 and up.
That's a problem.

I searched a bit, and found a Stephen LeBans suggestion from 1992/1993.
His suggestion is to force Access to recount the rows in the listbox.
In the Form_Load event of the form, he suggests putting:

Dim lngCount As Long
lngCount = Forms!frmParent!frmChild.Form.lstListBox.ListCount

Now, since the listbox is empty when the form opens, that is not what I did.
I put the code in the After_Update event of the listbox, figuring that
should work.
It doesn't work.
(I also tried putting it in the Form_Load, but no joy).

I added this message box:
MsgBox "RowCount is " & lngCount
which correctly shows "Row Count is 25".

No scrollbar ever appears.

What am I doing wrong?

Alan

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Alan Lane wrote:
Hello world:

I have a Parent form with a combobox, where the user selects a Contract or
Estimate number.
Then, on a subform, I have a listbox that gets filled with the details of
the selected Contract.
The subform listbox shows 21 rows.
That has been fine, but now we are starting to get some Contracts or
Estimates with more than 21 items.

When there are more than 21 items, no scrollbar shows up on the right side
of the listbox.
Users can't get to item 22 and up.
That's a problem.

I searched a bit, and found a Stephen LeBans suggestion from 1992/1993.
His suggestion is to force Access to recount the rows in the listbox.
In the Form_Load event of the form, he suggests putting:

Dim lngCount As Long
lngCount = Forms!frmParent!frmChild.Form.lstListBox.ListCount

Now, since the listbox is empty when the form opens, that is not what I did.
I put the code in the After_Update event of the listbox, figuring that
should work.
It doesn't work.
(I also tried putting it in the Form_Load, but no joy).

I added this message box:
MsgBox "RowCount is " & lngCount
which correctly shows "Row Count is 25".

No scrollbar ever appears.

What am I doing wrong?

Alan


In the GotFocus event for the listbox, enter something like
msgbox Me.YourListBoxControlName.ListCount

If there are 21 records, you'll see 21. If you have column headings,
you'll see 22. Now go to a record where you know there will be more
than 21 records

Check your query's SQL (View/SQL) and see if you use TOP, as in Select
Top 21...
Nov 13 '05 #2

P: n/a
I am as perplexed by your problem as you are. I use list boxes very
often but have not come across your problem.

I suggest that all of the counting of rows etc is a red herring. I
don't do any of that and my boxes show the scrollbar once the list
contains more than the default 8 values.

How about creating a new listbox on a copy of your form. Don't do any
of the row counting or other fancy stuff and see what happens.

Nov 13 '05 #3

P: n/a
Thanks to Salad and summerwind for their responses.

Things get wierder and wierder.

I accidently found out that, if I press either the <Ctrl>, <Shift> or <Alt>
keys while displaying my Parent/Child form with more data in the listbox
recordset than will show in the listbox, after having selected one of the
entries ... the listbox expands up to cover the whole subform!

I could not believe this was happening, so I phoned some of the users. It
works this way in both the Access XP mde and the Access 2003 mde. It seems
to me that the listbox should stay the size I set it, and not grow to take
up the entire subform. What is going on here? Is this a bug in Access? Do
I have a virus or something? Can anyone replicate this behavior?

Alan
"Alan Lane" <aw*****@yahoo.com> wrote in message
news:Ug****************@tornado.socal.rr.com...
Hello world:

I have a Parent form with a combobox, where the user selects a Contract or
Estimate number.
Then, on a subform, I have a listbox that gets filled with the details of
the selected Contract.
The subform listbox shows 21 rows.
That has been fine, but now we are starting to get some Contracts or
Estimates with more than 21 items.

When there are more than 21 items, no scrollbar shows up on the right side
of the listbox.
Users can't get to item 22 and up.
That's a problem.

I searched a bit, and found a Stephen LeBans suggestion from 1992/1993.
His suggestion is to force Access to recount the rows in the listbox.
In the Form_Load event of the form, he suggests putting:

Dim lngCount As Long
lngCount = Forms!frmParent!frmChild.Form.lstListBox.ListCount

Now, since the listbox is empty when the form opens, that is not what I
did.
I put the code in the After_Update event of the listbox, figuring that
should work.
It doesn't work.
(I also tried putting it in the Form_Load, but no joy).

I added this message box:
MsgBox "RowCount is " & lngCount
which correctly shows "Row Count is 25".

No scrollbar ever appears.

What am I doing wrong?

Alan

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.