combo box not showing entire list

J

Jim Burke in Novi

I have a strange problem with a combo box. It sometimes does not show all of
the rows from the query that is used for the RowSource. In the Open Event of
the form, I set the RowSource to one of two queries, depending on a
variable's value. In the one case, the combobox always shows all rows. In the
other it only shows the first eight or nine. I went into debug mode to make
sure all the code was being run properly, and when I step throught the code
in debug mode all the rows show up! Then when I turn off all breakpoints it
goes back to showing only the first eight rows. I know that it sets the
RowSOurce query properly, and I checked the query to make sure it is OK.
PLus, like I said, it works OK when stepping through in debug mode. This
seems to have started happening when I changed the ListRows value. It had
always been set to the default of 8. I changed it to 15, and not long after
noticed that it wasn't displaying all the rows in the one case. Any idea
what's going on here?! I'm at a loss. Thanks for any help.

Jim B
 
J

Jim Burke in Novi

I forgot to mention, I do a requery after I set the ROwSource, so that is not
the problem.
 
M

Marshall Barton

Jim said:
I have a strange problem with a combo box. It sometimes does not show all of
the rows from the query that is used for the RowSource. In the Open Event of
the form, I set the RowSource to one of two queries, depending on a
variable's value. In the one case, the combobox always shows all rows. In the
other it only shows the first eight or nine. I went into debug mode to make
sure all the code was being run properly, and when I step throught the code
in debug mode all the rows show up! Then when I turn off all breakpoints it
goes back to showing only the first eight rows. I know that it sets the
RowSOurce query properly, and I checked the query to make sure it is OK.
PLus, like I said, it works OK when stepping through in debug mode. This
seems to have started happening when I changed the ListRows value. It had
always been set to the default of 8. I changed it to 15, and not long after
noticed that it wasn't displaying all the rows in the one case.


Access is only loading some of the records so your form can
be displayed as quickly as possible. If you drop the
combo's list and scroll down the list, all the rows will
eventually(?) appear.

You can force Access to load all the rows immediately by
referring to the combo box's ListCount property. You
might(?) need to wait until the Load event.

Dim dummy As Long
dummy = Me.combobox.ListCount
 
M

Marshall Barton

Jim said:
I forgot to mention, I do a requery after I set the ROwSource, so that is not
the problem.


Don't do that. Setting the RowSource automatically
requeries the combo box, so adding your own Requery is a
waste of time.
 
J

Jim Burke in Novi

Actually the list would never show up completely, but I figured out what the
problem was. The two queries weren't defined exactly the same. One had 3
columns, the other 4 (the first three were the same as the other query, with
one additional field), and the combo box was defined to have 4. The one with
only 3 columns was the one that wasn't showing all of the rows. I changed the
query to have a 'dummy' fourth column and it is working fine now.
 

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