Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automatically record modified_date 2

Status
Not open for further replies.

wandwand

Technical User
Nov 18, 2005
2
US
Hi,

Is there any way to autometicly record the date and time when I modify data in a table in Access 2002? Is there any log file in Access 2002? Thanks for you help!

wand
 
Access doesn't have any triggers, so no - you cannot trap this at table level.

What you can do, since you shouldn't allow datamanipulation outside forms, you can use form events. The before update event of the form is perhaps closest to the ideal event to use to stuff information into a control bound to a date field.

Else, have a look at for instance something like what MichaelRed presents here faq181-291

Roy-Vidar
 
If you use a form rather than a table to enter the data, this becomes much easier.

I have two fields, DateCreated and DateModified.

The DateCreated field has a default value of =Now() with the locked property set to "Yes."

The DateModified is updated using the following code to update it's value on the Form Event “Before Update.”

Code:
Function DateModified()
On Error GoTo DateModified_Err

    With CodeContextObject
        .DateModified = Date
    End With

DateModified_Exit:
    Exit Function

DateModified_Err:
    MsgBox Error$
    Resume DateModified_Exit

End Function


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top