Show Date Difference only in a certain range

  • Thread starter Thread starter Chuck W
  • Start date Start date
C

Chuck W

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,
 
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
 
Back
Top