Calculate diff between 2 dates

B

BIGDB

MS Access 2000 How do I calculate the difference between 2
dates.
I have a field Date_Time. I input the date_Time with every
record entry along with a event of a process. I want to
know how much time in either days, Hours or Mins have
passed between two records. ie event no#'s (record no3) 57
and event no# (record no# 205. I want to know what the
date difference is ie:days between the date of record no#
57 and th record no# 205. Any help would be appreciated.
 
B

BIGDB

Thanks for the insight. I understand what you put me onto.
But I am stil lost. My date/Time is on every input/record.
I need to count D/H/M/N or seconds between entry 57 and
entry 207.?
 
G

Graham R Seach

What triggers the calculation? In any case, the following code may do what
you want.

MsgBox "There has been " & _
Diff2Dates("ymdhns", DLookup("[Date_Time]", "tblSomeTable", "PrimaryKey
= 57), _
DLookup("[Date_Time]", "tblSomeTable", "PrimaryKey = 205)) & _
" between the two dates."

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 
B

BIGDB

Graham.

Thank you so much. I think I have it now. I apreciate your
time to help me.
-----Original Message-----
What triggers the calculation? In any case, the following code may do what
you want.

MsgBox "There has been " & _
Diff2Dates("ymdhns", DLookup
("[Date_Time]", "tblSomeTable", "PrimaryKey
= 57), _
DLookup("[Date_Time]", "tblSomeTable", "PrimaryKey = 205)) & _
" between the two dates."

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd- 0764559036.html


BIGDB said:
MS Access 2000 How do I calculate the difference between 2
dates.
I have a field Date_Time. I input the date_Time with every
record entry along with a event of a process. I want to
know how much time in either days, Hours or Mins have
passed between two records. ie event no#'s (record no3) 57
and event no# (record no# 205. I want to know what the
date difference is ie:days between the date of record no#
57 and th record no# 205. Any help would be appreciated.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top