number of records in a query

C

Craig

I want to check whether a query actually returns any
values, and depending on the outcome run some code.
How do I check how many records are returned in a
particular query?
craig
 
W

Wayne Morgan

How you check it depends on how you are running the query. I'll need a
little more information about what you are doing.
 
G

Guest

Wayne,
When I select a drop-down list, I run a query to populate
the drop-down list. The query looks up the value of a field
and then returns all the codes associaetd with tat
parameter. The query is being called using the DoCmd.OpenQuery
I want to know if there are any records returned.

Craig
 
W

Wayne Morgan

One thing you could check would be the ListCount property of the combo box.
That will tell you how many items are in the drop down list. How are you
assigning the query to the combo box using OpenQuery? OpenQuery opens the
query for viewing.
 
J

Jack

The following function returns the number of records in a
query or table:
DCount("*","QueryName","FilterCondition")
If there is no filter, leave out the third argument.
 

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