calculating days

G

Guest

If I have an Hospital admit date and a hospital discharge date, I would like
to calculate the number of DAYS between them. How many days they were
inthe hospital. I have a DAYS field, but cant get the right combination to
calculate the days. Very sorry to be so ignorant. I did search to find
this answer, but I did not see it answered here.
 
C

Carl Rapson

buckpeace said:
If I have an Hospital admit date and a hospital discharge date, I would
like
to calculate the number of DAYS between them. How many days they were
inthe hospital. I have a DAYS field, but cant get the right combination
to
calculate the days. Very sorry to be so ignorant. I did search to
find
this answer, but I did not see it answered here.

Did you try the DateDiff function?

nDays = DateDiff("d", txtAdmitDate, txtDischargeDate)

Carl Rapson
 
J

John W. Vinson

If I have an Hospital admit date and a hospital discharge date, I would like
to calculate the number of DAYS between them. How many days they were
inthe hospital. I have a DAYS field, but cant get the right combination to
calculate the days. Very sorry to be so ignorant. I did search to find
this answer, but I did not see it answered here.

Your DAYS field *should not exist* in your table, if you have the admit date
and discharge date.

You can use a Query with a calculated field:

DAYS: DateDiff("d", [Admit Date], [Discharge Date])

or better, to avoid errors with nulls,

DAYS: IIF(IsNull([Discharge Date], Null, DateDiff("d", [Admit Date],
[Discharge Date]))


John W. Vinson [MVP]
 

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