How to return Max date or Null (if there is a Null present)

June 07th, 2012 - 10:16 pm ET by David Ball | Report spam
Hi,

I have a query where I Group By an Equipment Number field and then, for each equipment Number, return the Max (latest) Forecast Delivery date.

The problem is where one or more entries for a given Equipment Number has a Null in the Forecast Delivery date field. In these cases I need to return Null.

So, I need something like: "Return Max if there is no Null, otherwise return Null" for my Forecast Delivery field.

I have no idea how to do this Access so any help would be greatly appreciated.

Thanks very much.

Dave
email Follow the discussionReplies 1 replyReplies Make a reply

Similar topics

Replies

#1 John W. Vinson
June 08th, 2012 - 01:25 am ET | Report spam
On Fri, 08 Jun 2012 02:16:15 GMT, David Ball wrote:

Hi,

I have a query where I Group By an Equipment Number field and then, for each equipment Number, return the Max (latest) Forecast Delivery date.

The problem is where one or more entries for a given Equipment Number has a Null in the Forecast Delivery date field. In these cases I need to return Null.

So, I need something like: "Return Max if there is no Null, otherwise return Null" for my Forecast Delivery field.

I have no idea how to do this Access so any help would be greatly appreciated.

Thanks very much.

Dave




Try putting in a calculated field:

NZ([Forecast Delivery], #12/31/9999#)

That's the largest date Access can represent - if it's returned by your Max
query, you know that there's a NULL in the record.

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Fo...accessdev/
http://social.answers.microsoft.com...US/addbuz/
and see also http://www.utteraccess.com
email Follow the discussion Replies Reply to this message
Help Create a new topicReplies Make a reply
Search Make your own search