A2002 bug: ListCount problem

V

Vladimír Cvajniga

I'm using Czech version of A2002 but, as far as I can remembre, it was
similar in A97.

I have a ListBox lstOrg with this properties:
..ColumnCount = 9
..ColumnHeads = False
..ColumnWidths =
0cm;0cm;1,639cm;2,029cm;4,577cm;3,898cm;3,898cm;3,898cm;3,806cm

..RowSourceType = Table/Query
..RowSource =

.... and a TextBox txtOrgCount:
..ControlSource = =[lstOrg].[ListCount]


lstOrg.RowSource will be generated leater according to user's interaction.
But, weird, empty lstOrg gives ListCount = 1!!! Combo-boxes behave the samwe
way. Is there any workaround? Am I doing something wrong?

I know there's a problem with ColumnHeads property, but it is set to False
(No)... :-/
 
S

storrboy

Someone else previously mentioned this issue.

It's a documented situation so I'm not sure its can be called a bug. A
combo or listbox using a Table/Query as the rowsource will always have
a listcount of 1 when emtpy regardless of the ColumnHeaders. Value
Lists and Field Lists only start at one when the ColumnHeader is True.
You might notice that a query that returns no results usually contains
one blank line... I think the same thing happens in a table rowsource.
It starts off with one blank line. That blank entry is selectable as
well you might notice, although no value is given to the listbox.
 
V

Vladimír Cvajniga

Thx for your respond, storrboy. I have noticed that there's one blank line.
But this is what A2002 help says:

ListCount Property
See Also Applies To Example Specifics
You can use the ListCount property to determine the number of rows in a list
box or the list box portion of a combo box. Read/write Long.

expression.ListCount

expression Required. An expression that returns one of the objects in the
Applies To list.

Remarks
Microsoft Access sets the ListCount property to the number of rows in the
list box or the list box portion of the combo box. The value of the
ListCount property is read-only and can't be set by the user.

This property is available only by using a macro or Visual Basic. You can
read this property only in Form view and Datasheet view.

The ListCount property setting contains the total number of rows in the
combo box list or list box, as determined by the control's RowSource and
RowSourceType properties. If the control is based on a table or query (the
RowSourceType property is set to Table/Query and the RowSource property is
set to a particular table or query), the ListCount property setting contains
the number of records in the table or query result set. If the RowSourceType
property is set to Value List, the ListCount property setting contains the
number of rows the value list specified in the RowSource property results in
(this depends on the value list and the number of columns in the list box or
combo box list, as set by the ColumnCount property).

If you set the ColumnHeads property to Yes, the row of column headings is
included in the number of rows returned by the ListCount property. For combo
boxes and list boxes based on a table or query, adding column headings adds
an additional row. For combo boxes and list boxes based on a value list,
adding column headings leaves the number of rows unchanged (the first row of
values becomes the column headings).

You can use the ListCount property with the ListRows property to specify how
many rows you want to display in the list box portion of a combo box.
 

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