473,378 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Counting records returned in a combo-box on a form

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
4 2670
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: mgm | last post by:
hello, I have a query that is supposed to return only 1 record, however I recently found that because of an error in the database it can return more than 1. So what I need to do is capture if it...
7
by: C White | last post by:
A little while back I had a question about counting records and my example was something like this: in my database table i have the following records john ed john rick tom
1
by: Tony Johansson | last post by:
Hello Experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that I don't understand completely. It says "A garbarage...
1
by: Tony Johansson | last post by:
Hello Experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that I don't understand completely. It says "A garbarage...
1
by: MLH | last post by:
I have a challenge... In a table I call tblStuff4Letters with 3 fields: , and . I have a report called rptOutboundCorrespondence that feeds off this table. Sorting & grouping is turned on in...
2
by: Dale Ring | last post by:
Access 2000 I am trying to add "ALL" to a combo that is used to filter a query. When "ALL" is selected no records show instead of ALL records showing. I have setup a "dummy" table (tblDum)...
5
by: chrisc | last post by:
Hello, Hope this is the right place for this... I am creating a testing database for components as they come off a production line. My reports need to select faults that are found, as well...
13
by: Regnab | last post by:
The problem I'm having is the rsa.RecordCount always returns a '1' when I know there should be about 1600 records returned. I read somewhere that one should use '.MoveLast' before recordcount but...
9
by: GeRmIc | last post by:
Hi, I receive an XML string like <record> <value>...</value> </record> <record> <value>...</value> </record>....... etc.,
3
by: Sir Hystrix | last post by:
Hi, I am struggling with a simple query, but I just don't see it. I have the following example table. Table Messages ID Subject Reply_to 1 A 0 2 Ax 1 3 A 1
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.