DateDiff Help

YNWA

Registered User.
Local time
Today, 07:22
Joined
Jun 2, 2009
Messages
905
Hi, I have a querie calcuating the number of days between a refer date and a discharge date
However the discharge date field is always going to be blank.

How can I calculate this using datediff, so it calcs from date1 date to current date?

I have the follwing...

Code:
NumberofDays: First(DateDiff("d",[fldReferDate],[fldDischargeDate]))

I think I need something like Date() or Now() in there but unsure how to do it or if thats what I really need?

Currently that query runs but doesn't bring a value through, if I added a discharge date to one of the records, then it calcs the two dates fine.

The reason for it being blank, is I need to find number of patients who have no discharge date and how long they have been on the caseload based on their referral date.

Cheers
Will
 
NumberofDays: First(DateDiff("d",[fldReferDate],Nz([fldDischargeDate],Date())))

Should do the trick

David
 
NumberofDays: First(DateDiff("d",[fldReferDate],Nz([fldDischargeDate],Date())))

Should do the trick

David

Excellent as always David, thanks ;)

Would give you rep but I must spread it around before giving to you again.
 
Try this

DateDiff("d",[fldReferDate],nz([fldDischargeDate]),date())
or
DateDiff("d",[fldReferDate],date())
 

Users who are viewing this thread

Back
Top Bottom