Updated By and Date??

  • Thread starter Thread starter jwr
  • Start date Start date
J

jwr

Is it possible to add a "last updated by" and "last updated date" field on a
form?

Thank you
JR
 
jwr said:
Any suggestions??

In principle (and without knowing any complicating details), this should
be a very easy thing to do. You need to add fields UpdatedBy (text) and
UpdatedOn (date/time) to the design of the *table* on which the form is
based. You may then need to modify the form's recordsource, if it's a
query, so as to include those fields. Then you can put text boxes bound
to those fields onto the form.

Having done that, you need two things:

(1) You need an event procedure for the form's BeforeUpdate event that
assigns the current user's ID to the UpdatedBy text box, and the value
of the Date() function (or the Now() function, if you want to store the
date *and* the time) to the UpdatedOn text box.

(2) For there to be any point to this, you need a means to determine who
it is that is updating a record via the form. If the database is
secured via user-level security -- so people have to log into it with a
username and password -- then it's easy, because the CurrentUser()
function will give you the username. If the database is not secured
that way, though, that's not helpful, because CurrentUser() will always
give you "Admin". If that's the situation, you can pick up the current
user's network name by using the code posted here:

http://www.mvps.org/access/api/api0008.htm
API: Get Login name
 
It certainly is. They will display whatever value is contained in the record
in the Form's RecordSource which is specified in the Control's
ControlSource. You can reset those "underlying" values in the BeforeUpdate
event, with care.

They cannot be automatically handled if you allow users to update from
Datasheet view of Tables or with Queries. These are not values that are
maintained by Access itself or the database engine.

Larry Linson
Microsoft Access MVP
 
Back
Top