Recording Time Values

iandanescourt

New member
Local time
Today, 05:51
Joined
Apr 29, 2004
Messages
8
I Have a problem in which when I create a record I wish the record to automatically record the time it was created. I have achieved this by having a timerecorded field within the table and setting its default value to time().

later on I wish another time to be recorded. This time when the user selected an option box to -1 I wish the time to be stamped into another field. I have used this event procedure to write the time to another field.

Private Sub AOGCleared_AfterUpdate()

'Update Time

If Me.AOGCleared = -1 Then
Me.TimeAOGCleared = Time()
Else
Me.TimeAOGCleared = ""

End If



End Sub

however It records the original time of creation when the obtion box is selected. Can anyone please point me in the direction of how I get access to record this later time please ?
 
one time value is created and stamped when the record is created by having a default value in the table of time() lets call this the Time of creation. This records the time of the system when the record is created.

The table has other fields for other values, one of which is another time field.

When a specific option is selected by a tick box I wish the system to enter the time at which that specific field was updated lets call this the time of closure, which I thought that I could achieve with the code above.

What the code actually does when the tick box is selected is record in this second time field the time of creation. i.e both time fields show the time of creation. I wish to have time of creation and time of closure recorded.

hope that explains better what I am attempting to achieve
 
What format are you using for the "TimeAOGCleared" field? If thisis set to hours and minutes only then it is possible that the time will show the same as when the record is created depending on how fast the user moves through the form.
 
Hi Kevin. thanks for the response however the format is in hours, minutes and seconds. its not the formatting causing the problem. If i go in now days later the time still comes in at the same value. here is the test database that I am working on if anyone fancies a look. It must be an obvious mistake to someone out there !!

Thanks

Ian
 

Attachments

Hi Ian,

Sorted. Firstly I would recomended changing the name of your text box that holds the value for TimeAOGReported from being called "Time" to something more descriptive like "txtTimeAOGReported" which I think is a reserved word. Also the TimeAOGCleared text box did not have a format set so set that to a format of "Long Time"

In the afterupdate event of the AOGCleared check box change the code from

Code:
Private Sub AOGCleared_AfterUpdate()

'Update Time

If Me.AOGCleared = -1 Then
     Me.TimeAOGCleared = Time()
Else
    Me.TimeAOGCleared = ""
End If

End Sub

To

Code:
Private Sub AOGCleared_AfterUpdate()

'Update Time

If Me.AOGCleared = -1 Then
    Me.TimeAOGCleared = Now()
Else
    Me.TimeAOGCleared = ""
End If

End Sub

I hope this helps

Kevin
 
Thanks Very Much

Kevin

you are a gentleman and a scholar. Thank you for your time

Ian

:D
 

Users who are viewing this thread

Back
Top Bottom