Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to subtract the first item from the last in a query

Status
Not open for further replies.

warmongr

MIS
Joined
Mar 17, 1999
Messages
214
Location
US
I have an access database with timestamps in 3 second intervals over a duration of time. (in epoch)

I'd like to take the last item and subtract it from the first item so in my pivotchart or report I can have a subheader that says something to the effect of TIME INTERVAL: 35 (in minutes)

Any thoughts on how?

I can do it in perl but access is a new beast for me.

War
 
What is the actual SQL code of your query ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Keep in mind there really isn't any First or Last in tables. There are Min and Max.

If I understand correctly, you should be able to use a text box in your report header or footer with an expression like:

=DateDiff("n",Min([TimeStamp]),Max([TimeStamp]))

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
You know I never thought of that. Since I'm in Epoch time I can subtract the min from the max. Duh! Guess that's why you're the MVP. Btw: Does Access recognize epoch time format? Can I convert Epoch time to another time format?

Thanks,
 
I'm fairly certain you can convert Epoch time to standard datetime. You might want to check out functions like:
DateAdd()
DateSerial()
CDate()

If you can't figure out the conversion, come back with a new thread. You might want to define "epoch" time and give some examples and their converted values.


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top