Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting records from a query...

Status
Not open for further replies.

dodgyone

Technical User
Jan 26, 2001
431
GB
I have a series of queries which give results depending upon certain date. From these I create charts etc.

What I would like is to count how many records there are once the query has completed (the date criteria is not fixed so the query requests the dates as you start it up). I would then like to be able to place this total in a table, in a certain row.

Is DCount the best options... how does it work etc?

Thanks,

Marcus
 
This is the DCount function. Just change the values appropriately. The first "Shipped date" would be the field you want to count, The "Orders" is the name of the table, and the second "ShippedDate" is the criteria.

x = DCount("[ShippedDate]", "Orders", "[ShippedDate] = #1/1/2001#")

You could also use between:

x = DCount("[ShippedDate]", "Orders", "[ShippedDate] Between #1/1/2001# AND #1/31/2001#") Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top