Comparing Dates with a condition

  • Thread starter Thread starter radiaz via AccessMonster.com
  • Start date 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
 
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])
 
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])
 
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])
 
Back
Top