Comparing Dates with a condition

Comparing Dates with a condition

Post by radiaz via » Sat, 27 May 2006 02:45:36


Hello,

I'm doing calculations on date fields and I need to use the if or Iff
condition. I've never used it before. Can anybody help me on accomplishing
this? Does it have to be done in Visual Basics or can I do it at the query
design view?

Below are examples on what the data looks like,

Start Time
4/3/2006 7:57:00 PM
4/3/2006 9:00:00 PM

ReceivedOn
4/3/2006 8:56:59 PM
4/3/2006 5:18:55 PM

ValidatedTime
4/3/2006 8:57:07 PM
4/3/2006 9:01:01 PM

If StartTime is after (>) than ReceivedOn then, Latency= ValidatedTime-
StartTime

Otherwise, Latency=ValidatedTime-ReceivedOn

Thanks,

Rita

--
Message posted via AccessMonster.com
http://www.yqcomputer.com/
 
 
 

Comparing Dates with a condition

Post by radiaz via » Sat, 27 May 2006 02:55:26


It will look like something like this,

Latency: If CDate([StartTime]) > CDate([ReceivedOn]) then

DateDiff('s',[Validated],[StartTime]) else

DateDiff('s',[Validated],[ReceivedOn])

--
Message posted via http://www.yqcomputer.com/

 
 
 

Comparing Dates with a condition

Post by S0FSTCBERV » Sat, 27 May 2006 03:20:02

Latency: Format(IIf([StartTime] >= [ReceivedOn], [ValidatedTime]-[StartTime],
[ValidatedTime]-[ReceivedOn]), "h:nn:ss")
 
 
 

Comparing Dates with a condition

Post by John Spenc » Sat, 27 May 2006 05:44:20

Latency: DateDiff("s", [ValidatedTime], IIf([StartTime] >[ReceivedOn],
[StartTime], [ReceivedOn]) )