Listcount Quirks

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
 
M

Michel Walsh

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
 
G

Guest

Thanks, Michel. But how do I specify a non-empty rowsource which you've
suggested? Thanks.
ck
 
M

Michel Walsh

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
 

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

Similar Threads

Listcount 3
Access Cannot select items in listbox 1
Listbox Delete multiple items 1
Cannot Get ListBox .ItemsSelected, help! 1
ListBox focus 4
Listbox selected count 3
Go to ItemID in listbox? 1
Listbox ListCount 2

Top