Modify Date procudure

  • Thread starter Thread starter BajaGeary
  • Start date Start date
B

BajaGeary

I have tried to use the following code to modify the date when a record is
updated. NO JOY! Nothing happens.
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
 
Are you sure the procedure is 'firing'? Add a breakpoint and check it out.

Also, why bother with separate datemodified and timemodified fields? You
can store a date/time value for modified and use Now() to get both in a
single field.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I have tried to use the following code to modify the date when a record is
updated. NO JOY! Nothing happens.
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

From the control name it appears that this is an OLE object frame. What's in
the field and how are you updating it? I'm pretty sure the BeforeUpdate event
fires only when the *user* directly updates the field.
 
Back
Top