Modify Date procudure

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
 
J

Jeff Boyce

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
 
J

John W. Vinson

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.
 

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