Comparing Dates with a condition

  • Thread starter radiaz via AccessMonster.com
  • Start date
R

radiaz via AccessMonster.com

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
 
R

radiaz via AccessMonster.com

radiaz said:
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

It will look like something like this,

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

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

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

KARL DEWEY

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



radiaz via AccessMonster.com said:
radiaz said:
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

It will look like something like this,

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

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

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

John Spencer

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

radiaz via AccessMonster.com said:
radiaz said:
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

It will look like something like this,

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

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

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