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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate response time 1

Status
Not open for further replies.

rmh3619

Technical User
May 29, 2006
29
0
0
NL
I have two now() values in text boxes (txtDate1 and txtDate2)

the first date is the registration date and the second is the start date. i want to calculate the response time (date2 - date1) and have the result in the format hh:mm:ss

How can i do this?
 
Bring up the property sheet of the textbox where you have your calculation, =[txtdate1]-[txtdate2]
For the Format option, put hh:nn:ss
 
thanks fneily but this does not entirely produce the result i'm looking for.

if for instance the registration date was 2 days, 4 hours and 10 minutes ago i want the value in the txtResponse textbox to show 52:10:00
 
Oh, the Now() threw me.
I created two textboxes. The control source for the first was
=DateDiff("n",[testDate1],[testDate2])
This changes the difference to minutes.
The control source of the second is
=[TotalMin]\60 & Format([TotalMin] Mod 60,"\:00")
This formats it the way you want.
So you can make the first textbox invisible.
 
I need glasses. I just reread your post and you want seconds.
So you can create an unbound textbox, then on the Oncurrent event of the form you can put:

Private Sub Form_Current()
Dim secinterval
Dim x
secinterval = Me![testdate2].Value - Me![testdate1].Value
x = Int(CSng(secinterval * 24)) & ":" & Format(secinterval, "nn:ss")
Me![Text9].Value = x
End Sub

Text9 is the unbound textbox in this case.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top