From: Chuck W on
Hi,
I have a table called tblReadmits that has AdmitDate, DischargeDate and
AdmitDate2 as date fields. I created a query with a calculated field called
ReadmitDays which is AdmitDate2 - DischargeDate. I only want a value to show
in this field though if it is between 0 and 30. Otherwise, I want it to be
null. Can someone help with an SQL statement which will do this?

Thanks,
From: John Spencer on
IIF(AdmitDate2-DischargeDate Between 0 and 30, AdmitDate2-DischargeDate,Null)

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Chuck W wrote:
> Hi,
> I have a table called tblReadmits that has AdmitDate, DischargeDate and
> AdmitDate2 as date fields. I created a query with a calculated field called
> ReadmitDays which is AdmitDate2 - DischargeDate. I only want a value to show
> in this field though if it is between 0 and 30. Otherwise, I want it to be
> null. Can someone help with an SQL statement which will do this?
>
> Thanks,