Auto store date created & updated, EmpId created by and Updated by

  • Follow


I don’t know what I am looking for is possible or not…
I have table CustTracking: Fields – CustID, Exc_ID, AssignedDept, 
AssignedUser, EmpIDCreated, EmpIDUpdated, Comments, FollowupDt, DateCreated, 
DateLastUpdated

From above fields, some fields will be entered by user, but fields – 
EmpIDCreated, EmpIDUpdated, DateCreated & DateLastUpdated will be updated 
automatically.

I want to create forms from this table to add and edit data but for these 
fields (EmpIDCreated, EmpIDUpdated, DateCreated & DateLastUpdated) I have no 
idea about how to write the code for this.
This forms opens when login is successful. So
I can explain the logic:
EmpIDCreated: When Emp Log on to this form and enter new item first time, 
that EmpID should be stored in this field.
EmpIDUpdated: When Emp changes/edit the item, and who edits last time, this 
field should save log on user id
DateCreated: when the item is first time created (should update from 
systemdate)
DateLastUpdated: date when the item is lastupdated (should update from 
systemdate)

Thanks,


0
Reply Utf 11/19/2009 8:30:01 PM

kay wrote:

>I don�t know what I am looking for is possible or not�
>I have table CustTracking: Fields � CustID, Exc_ID, AssignedDept, 
>AssignedUser, EmpIDCreated, EmpIDUpdated, Comments, FollowupDt, DateCreated, 
>DateLastUpdated
>
>From above fields, some fields will be entered by user, but fields � 
>EmpIDCreated, EmpIDUpdated, DateCreated & DateLastUpdated will be updated 
>automatically.
>
>I want to create forms from this table to add and edit data but for these 
>fields (EmpIDCreated, EmpIDUpdated, DateCreated & DateLastUpdated) I have no 
>idea about how to write the code for this.
>This forms opens when login is successful. So
>I can explain the logic:
>EmpIDCreated: When Emp Log on to this form and enter new item first time, 
>that EmpID should be stored in this field.
>EmpIDUpdated: When Emp changes/edit the item, and who edits last time, this 
>field should save log on user id
>DateCreated: when the item is first time created (should update from 
>systemdate)
>DateLastUpdated: date when the item is lastupdated (should update from 
>systemdate)


The created date is trivial to do.  Just set the table
field's DefaultValue to Now()

The code to set the last updated field needs to be in the
form's BeforeUpdate event procedure:
	Me.DateLastUpdated = Now()

-- 
Marsh
MVP [MS Access]
0
Reply Marshall 11/19/2009 11:55:23 PM


1 Replies
156 Views

(page loaded in 0.864 seconds)

Similiar Articles:












7/21/2012 7:18:32 PM


Reply: