Listcount Quirks

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Why is it that when I have a unbound text box with the controlsource set as
=listbox.listcount, it ALWAYS show 1 when I open the form even though there
are items displayed in the listbox?

But when I select a record with no items to be displayed in the listbox, it
will then show correctly as 0.
ck
 
Hi,


I *suspect* that as long as you don't specify a recordset, the control
falls back to the infamous "AddItem" behavior, where NULL is "the" value
that pre-fill the list.

Specify a not empty rowsource, at design time, to avoid the problem, at
runtime, is possible in your case?



Hoping it may help,
Vanderghast, Access MVP
 
Thanks, Michel. But how do I specify a non-empty rowsource which you've
suggested? Thanks.
ck
 
Hi,


Assign the property, Row Source, visible in the sheet of properties, in
design mode, to something like

SELECT * FROM table1 WHERE 1=2

which returns no record.
(have an existing table name and try to mention the right number of fields,
rather than using *)



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top