Expression Challenge

Tom Vert

New Member
Joined
Oct 30, 2004
Messages
43
My database is based on one table which includes the numeric field Action, and the date fields, DateIn and DateOut. Action is a 6-digit number that can be considered a work order and remains the same until the action is finalized. When an action comes into our office, we record the DateIn, and when it is complete, we record DateOut. Sometimes we need to return the action to the originator (sometimes more than once), in which case both DateIn and DateOut are recorded, before we can finalize it. We run several reports based on these dates.

Here's my problem: In some reports, I want a control to count only the most recent action (see red entry below) when DateOut is null. How do you create an expression in the report that ignores earlier 'DateOut' dates (is not null) and only applies the expression to the most recent action where DateOut is null? Is there a variation of the count function that would help me to count only the most recent action that has no DateOut? Thanks much for the help.

DateIn DateOut

1 May 07 4 May 07
5 May 07 6 May 07
7 May 07 Is Null
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi Tom

DCount doesn't work with null values very well so you need to use another function (e.g. the nz function) to convert the null value to something else. I tested this in an unbound text box in a report and it returned the correct value:

=DCount("[MyKeyField]","MyTable","Nz([MyDateField],0) = 0")

Make sure you use your actual field and table names.

HTH, Andrew
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

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