Query help with counts and unique records

DavidAC

Board Regular
Joined
Feb 10, 2003
Messages
134
Office Version
  1. 365
Help,
i am running a query which counts the number of records that match a certain criteria, however as soon as i add a new order number to the data i get a #error, i have now worked out the query is not taking any notice of the order number so just groups them all together. however i need to keep the orders seperate and show the counts per individual order number. the count i am using is
=DCount([order_no],"Isolator_Query_showing_jobs_to_do","[date_completed] Is Null")

you can have the same order number more than once so i just need to count the number of occurances within each order number and then display them on a form.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Can you do this in the recordsource of your query as opposed to the expression? I'm assuming you have a date field in your table
Because you could just use something like

Select orderid, count(orderid) as count_of_ orders
from yourtable
group by orderid;

It sounds like you could use a field like "Order_DetailId in a second table. Then you could easily create a relationsship between hte tables with a one-to-many relationship on OrderID to Order_DetailsID
 
Upvote 0

Forum statistics

Threads
1,221,798
Messages
6,162,027
Members
451,737
Latest member
MRASHLEY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top