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

Counting records returned in a combo-box on a form

P: n/a
MLH
I have a combo box control on a form and a text
box beside it in which I would like to display the
number of listings in the combo-box. The combo
box lists more or fewer rows depending on the
user's selection and application of various filtering
mechanisms on the form. So, I cannot use DAO to
count the records returned by the QBF SQL.

Is there another way I can determine the number
of records returned by the dropdown box?
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
MLH
On more thing...

It seems this topic has been hammered a fair amount
inside this NG. Ultimate solutions, though, are not
quite as well documented. I'm wondering if dynamically
creating and saving a query, performing a quick DCount
on it - followed by, of course, deletion of the saved qry
is the ticket. You know, when the bang-char is getting
in the way of dealing with the situation via DAO calls.
Nov 13 '05 #2

P: n/a
MLH <CR**@NorthState.net> wrote in
news:os********************************@4ax.com:
I have a combo box control on a form and a text
box beside it in which I would like to display the
number of listings in the combo-box. The combo
box lists more or fewer rows depending on the
user's selection and application of various filtering
mechanisms on the form. So, I cannot use DAO to
count the records returned by the QBF SQL.

Is there another way I can determine the number
of records returned by the dropdown box?


Just interrogate the combo box's .listcount property.after you
change the sql.

--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #3

P: n/a
Bob Quintal wrote:
Just interrogate the combo box's .listcount property.after you
change the sql.


The other thing to keep in mind is how to deal with combos where show
headings is set to YES. You can use cboMyCombo.ListCount -1, but if the
selections a user makes result in no records showing on the combo,
you'll get -1 in your text box. In which case, the following works as a
controlsource for the text box:

=iif(cboMyCombo.ListCount=0,0,cboMyCombo.ListCount-1)

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #4

P: n/a
MLH
On Sun, 23 Oct 2005 01:03:36 -0230, Tim Marshall
<TI****@PurplePandaChasers.Moertherium> wrote:
Bob Quintal wrote:
Just interrogate the combo box's .listcount property.after you
change the sql.
Great property, Bob. Thx for heads up on it. Saves me a lot of hassel.
The other thing to keep in mind is how to deal with combos where show
headings is set to YES. You can use cboMyCombo.ListCount -1, but if the
selections a user makes result in no records showing on the combo,
you'll get -1 in your text box. In which case, the following works as a
controlsource for the text box:

=iif(cboMyCombo.ListCount=0,0,cboMyCombo.ListCoun t-1)

Tim - I like this. I guess this means a cbox w/ showheadings true
will have listcount property of 3 if 2 actual data rows and the header
row show in the list. I'll have to find all that I use headers on and
compensate for it. Do love the listcount property.
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.