number of records in a query

  • Thread starter Thread starter Craig
  • Start date Start date
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
 
How you check it depends on how you are running the query. I'll need a
little more information about what you are doing.
 
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
 
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.
 
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.
 
Back
Top