ElapsedTime Code in Query to determine time between dates.

ml8889

Registered User.
Local time
, 21:07
Joined
Oct 12, 2012
Messages
19
Hi, I have code that will determine that days between two date fields in my query. The issue that I have is the days return perfectly when both date fields have data. However when the Begin Date field has a date but the End Date field doesn't yet have a date, it returns #Error. Is there a way to make is show nothing, no error for those records or can I give a default value when there is that error? The expression is working correctly but i just want to hide this error for non-populated end dates. Thanks!
 
You need to wrap it in a conditional statement to test to see if data is valid. Something like this:

=IIf(isnull([EndDate]), "", DateDiff("d", [BeginDate], [EndDate]))
 
Thank you. Should I make this adjustment in the VB code or the query expression? (Or the report?)
 
Yes. Wherever you are currently using the Date calculation put it there.
 
Great great great IT WORKED.... I just love Access-Programmers site. This is such a usefull tool. WOW!
 

Users who are viewing this thread

Back
Top Bottom