Query Calculation

Tom Vert

New Member
Joined
Oct 30, 2004
Messages
43
I’m working with a form based on a query. Among others, my table has two date fields: DateIn and DateOut. The query counts the number of records with a DateIn of <=15 days from today’s date. Expression is: <=15: Count(IIf([DAYS]<=15,"1")). “DAYS” is calculated using the DateDiff function.

In a calculated control on the form, I’m trying to count the number of records with a DateIn, but no DateOut, using: =Sum(IIf([<=15] And IsNull([DateOut]),"1")) as the control source.

If works fine, but when the query counts two or more occurrences with the same DateIn, my form will only count one occurrence. Is there a work around for this? Thanks.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Andrew Fergus

MrExcel MVP
Joined
Sep 9, 2004
Messages
5,452
Office Version
  1. 365
  2. 2021
  3. 2016
Platform
  1. Windows
Hi
Can you do the second count in the query instead of on the form?
Andrew
 
Upvote 0

Forum statistics

Threads
1,195,619
Messages
6,010,736
Members
441,567
Latest member
Flitbee

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
Top