Timer Programme

  • Thread starter Thread starter Viswanathan S
  • Start date Start date
V

Viswanathan S

Hi all,
I am trying to design a Database for my work with a Timer
for each call that I take (I am a Customer Service Rep).
So I have a Button that I use, press immediately when I
get a call and press the same again when I end the call.
The in between time is updated on another field (HT)
connected to the database.
Now the problem!! When I do the same and jump to the next
record, the HT field is already filled with the previous
call time. I have pasted the script that I try. Please
help me to avoid the same...

Option Compare Database
Dim myToggle As Boolean
Dim myAHT As Date
Dim myTime As Date

Private Sub Command33_Click()

If myToggle = False Then
myToggle = True
Else
myToggle = False
End If

If myToggle = True Then
Command33.Caption = "&End Call"
myTime = Now()
Else
Command33.Caption = "&Start Call"
' Command33.Enabled = False
myAHT = Format((myTime - Now()), "hh:mm:ss")
End If
End Sub
Private Sub HT_Enter()
HT.Text = Format(myAHT, "hh:mm:ss")

End Sub

Thank you.
Viswanathan S
 
It will be, you are storing the value in a form-level variable which will
persist between records. I don't think that you need anything as complicated,
how about :-

Option Compare Database
Dim myToggle As Boolean
Dim myTime As Date

Private Sub Command33_Click()
If myToggle = False Then
myToggle = True
Command33.Caption = "&End Call"
myTime = Now()
Else
myToggle = False
Command33.Caption = "&Start Call"
HT = myTime - Now()
End If
End Sub
 
Back
Top