DATEMODIFIED FIELD

B

BajaGeary

I am trying to use the follow code in the before update properties to enter
the date a record has been changes. NO WORKIE!
WHY?
Private Sub OLEBound230_BeforeUpdate(Cancel As Integer)
'Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo BeforeUpdate_Err

' Set bound controls to system date and time.
DateModified = Date
TimeModified = Time()

BeforeUpdate_End:
Exit Sub

BeforeUpdate_Err:
MsgBox Err.Description, vbCritical & vbOKOnly, _
"Error Number " & Err.Number & " Occurred"
Resume BeforeUpdate_End
End Sub
 
D

Dale Fye

You would normally use the Forms BeforeUpdate event for this. Assuming that
DateModified and TimeModified are fields that exist in the Recordset of the
form, then the following should work. Personally, I prefer to use a single
field (Modified) and use the Now() function to fill it with both date and
time information.

Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo BeforeUpdate_Err

' Set bound controls to system date and time.
me.DateModified = Date
me.TimeModified = Time()

BeforeUpdate_End:
Exit Sub

BeforeUpdate_Err:
MsgBox Err.Description, vbCritical & vbOKOnly, _
"Error Number " & Err.Number & " Occurred"
Resume BeforeUpdate_End
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top