Show Date Difference only in a certain range

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,
 
J

John Spencer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top