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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code for Date Stamping?

Status
Not open for further replies.

mattpearcey

Technical User
Mar 7, 2001
302
GB
I am having a little trouble building a small form in Access 97 to show four simple fields: Date created, Created by user, Date changed, Changed by user. So it will monitor who has entered the data and who has changed it. I have got in working up to the point as i can get the date created up, as that is simple. But as for the rest, i know i have to fiddle with the code to get this to work. Does anyone have any small, simple scripts that i can input in to get this to work? Thank you for your help already.

Matt Pearcey
 

Sub Form_Before_Insert()

Me!DateCreated = now()
Me!CreatedByUser = CurrentUser()

End Sub

Sub Form_Before_Update()

Me!DateLastUpdated = now()
Me!UpdatedByUser = CurrentUser()

End Sub
 
Great. Similar to what i have got already, but i can see what changes i have to make. How will this then turn out? I.e. in a datasheet format and Against each record, it wil show who has created it, and who has updated it? What if it has been updated multiple times. Will this code run each time it has been updated and create a different date each time or will it just overight the last time it was updated? Thank you for your help already.

Matt Pearcey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top