how to create datediff function?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with the ambulance call data. I need to create a query that
calculates the time difference between "T2_Notified" and "T3_Enroute" fields
in minutes. How would the formula look like?
Thanks
 
The calculated field would look like this in the design grid:
ElapsedTime:DateDiff("n",[T2_Notified], [T3_Enroute])

In the SQL view, this would look like
DateDiff("n", [T2_Notified], [T3_Enroute]) As ElapsedTime

If there is more than one table in the query with fields that have these
names, you'll have to also specify the table.
ElapsedTime:DateDiff("n",[Table1].[T2_Notified], [Table1].[T3_Enroute])

The syntax for the functions is in the VBA help file. If you open the code
editor (Alt+F11) and search help for DateDiff, you will find the syntax.
 
DateDiff ("n", T2_Notified, T3_Enroute)

The common mistake (I know- I make it all the time) is to use "m" instead of
"n". "m" gives you the difference in months.

Good Luck!
 
Back
Top