A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date Diff



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2008, 08:37 PM posted to microsoft.public.access.queries
Dan @BCBS
external usenet poster
 
Posts: 195
Default Date Diff

This expression in a query returns a date differance.
If the dates in both values are the same it returns "0" which makes sense
but is there a way to default a zero to "1"?
Another words is an appeal is opened and closed the same day I need this to
return "1".

Appeals: DateDiff('d',[received],[closed])

thanks
  #2  
Old April 29th, 2008, 08:54 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Date Diff

Appeals:
IIF(DateDiff('d',[received],[closed])=0,1,DateDiff('d',[received],[closed]))

--
KARL DEWEY
Build a little - Test a little


"Dan @BCBS" wrote:

This expression in a query returns a date differance.
If the dates in both values are the same it returns "0" which makes sense
but is there a way to default a zero to "1"?
Another words is an appeal is opened and closed the same day I need this to
return "1".

Appeals: DateDiff('d',[received],[closed])

thanks

  #3  
Old April 29th, 2008, 09:30 PM posted to microsoft.public.access.queries
Dan @BCBS
external usenet poster
 
Posts: 195
Default Date Diff

Perfect
Thanks




"KARL DEWEY" wrote:

Appeals:
IIF(DateDiff('d',[received],[closed])=0,1,DateDiff('d',[received],[closed]))

--
KARL DEWEY
Build a little - Test a little


"Dan @BCBS" wrote:

This expression in a query returns a date differance.
If the dates in both values are the same it returns "0" which makes sense
but is there a way to default a zero to "1"?
Another words is an appeal is opened and closed the same day I need this to
return "1".

Appeals: DateDiff('d',[received],[closed])

thanks

  #4  
Old April 29th, 2008, 09:51 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Date Diff

Dan @BCBS wrote:

This expression in a query returns a date differance.
If the dates in both values are the same it returns "0" which makes sense
but is there a way to default a zero to "1"?
Another words is an appeal is opened and closed the same day I need this to
return "1".

Appeals: DateDiff('d',[received],[closed])



IIf(received=closed, 1, DateDiff('d',received,closed))

--
Marsh
MVP [MS Access]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.