Need help updating dates on same record!

Bachfile

Registered User.
Local time
Today, 13:04
Joined
Jul 4, 2002
Messages
41
Hi guys

I have a "daily update" form for users to use after they have finished entering data etc. so that they're steps are retraceable. I made so instead of having separate records - I made it so that there was only one record, with all of the info provided being appended to a memo field that is locked.

I included data and time expressions (=date() ) and (=time() ) in the after update section of each field, but whenever I update the form, the date nor the time is updated, in fact, nothing shows up at all. The only time the date seems to update is if I create a new record, which I don't want to do.

Here is my code:

Private Sub Command10_Click()
Dim rs As String
rs = Chr(13) & Chr(10) & "Update by: " & Me.Person
rd = Chr(13) & Chr(10) & "On: " & Me.Date
rf = Chr(13) & Chr(10) & "At: " & Me.Time
rg = Chr(13) & Chr(10) & "Detail of Update: " & Me.UpdateEntry & vbCrLf

Me.PermanentIndex = rs & rd & rf & rg & Me.PermanentIndex

Me.Person.Value = Null
Me.Time.Value = Null
Me.UpdateEntry.Value = Null
Me.Form.Refresh
Me.Time.Requery
Me.Date.Requery

End Sub


Thanks a lot for any help you can offer guys!

Bachfile
 
A couple of things wrong here. Date and Time are both reserved words since they are VB function names. Rename your controls to avoid subtle problems. You don't need the Refresh or Requery statements. You don't need (and shouldn't use) separate fields for date and time. A single field will suffice. I presume that you want to store the current date/time in a bound field. Setting a field's controlsource to other than a column name makes the field unbound. therefore =date() will show the date when you look at the form but it will not be saved. Access has no idea which field to save it in :)

Add to the click event a statement that will store the current date/time:

Me.LastChangedDate = Now()
 
Thanks Pat, everything works perfectly now.

Cheers,

Bachfile
 

Users who are viewing this thread

Back
Top Bottom