-----Original Message-----
Hey, that looks familiar!
Let me make it simpler.
(1) Add the following field to your table:
name: LastUpdatedBy
type: Text
length: 30 characters
(2) In the editing form that is based on that table, add the following event
procedure to the form's code module:
private sub form_beforeupdate(cancel as integer)
me![lastupdatedby] = "fred smith"
end sub
Now, when you add a new record or edit an existing record, the name "fred
smith" will be written to the LastUpdated field of the record.
Of course, you do not want the name to be "fred smith" in every case! You
want the real name of the current user. In general, you can get that in one
of two ways:
(1) Have an inputbox which pops up when the database starts, & asks the
user to enter their name. Store that name in a global string variable in a
standard module (ie. a module that is not attached to any particular form).
Use that string variable instead of the string constant "fred smith" in the
code in (2) above.
or:
(2) Use the Access "user level security" features to ensure that each user
is required to log-on with a valid user name & password. Then replace the
fixed string "fred smith" with a call to the CurrentUser () function.
CurrentUser() returns the user name of the user who is currently logged-on.
However, if you have not yet used the user level security features to
require each user to log on, then, CurrentUser() will just return the fixed
string "Admin", which is not much help to you.
If you need more information, please continue asking in this thread. Do not
start a new thread! That just confuses everyone.
HTH,
TC
Satya Krishna Dasa said:
I recently asked about making a field that tracks which
users modify, update which records and when. I got this
response, but it seems unclear. Does anyone have more
advice?
You would need to do several things.
- define a field in each table to hold this information;
- establish Access "user level security" so each user is
required to log-on
with a valid username & password, then
- write a BeforeUpdate event procedure for each form, to
copy the value of
the CurrentUser(0 function into the new field of the table.
.