Time() returns a null

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

Guest

I'm coding a MS Access 2000 application where I need to capture the
startingtime of a procedure, the end time of a procedure, and calculate the
total length of the procedure. The user can either manually enter the time
in medium time format or press a button to return the system time (Time() )
in medium format. The code for this button looks like this:

Private Sub cmdStTime_Click()

Forms!frmTilt!txtStTime = Time()
End Sub

The end time is captured behind the scenes when the form is closed. This
too is Time(). Total procedure time is endtime - starttime. The code looks
like this:

dteEndTime = Time()
dteStartTime = Forms!frmTilt!txtStTime

dteProcTime = Format(dteEndTime - dteStartTime, "Medium Time")

This code works in 10 other similar forms. When I run the debugger and step
through the code the application indicates that Time() = null. If I set a
default value on the form for the control (Time() ) the value of system time
is returned.

This has me puzzled. I've compacted, deleted the offending controls and
re-placed new ones, etc.

Any ideas?

Thanks for your help.
 
The Time function lives in the VBA library. Make sure you have a reference
to Visual Basic for Applications.
You can try entering
?VBA.Time() and see what happens.
 
Thanks for the reply, however, the reference is not the problem. I did run
what you suggested and it returned the system time in the immediate window.

This line of code returns the null value for system time:
dteEndTime = Time()

There are 10 other forms in the same application that use the same code to
return the system time with no problems. This form remains a problem child.

Anyone else have a suggestion?
 
It could be the form is corrupted
Delete the form
Decompile the application
Re create the form.
 
Back
Top