Date Created and Created By

A

Allen Browne

Date created is easy. Just add a Date/Time field to your table, and set its
Default Value property to:
=Now()

As for who created the database, what user name do you want? If you are
using Access security where everyone signs in with a user name and password,
you could use CurrentUser(). If not, you could use the Windows user name.
Code here:
http://www.mvps.org/access/api/api0008.htm
Either way, use the BeforeUpdate event procedure of the form to assign this
value to the Text field you created.
 
A

ajhome

I am having a hard time with the code on your page. I copied all of it and
put it into the before update event. I am getting an error code from Access
that says that only comments may appear after end sub and so on. What am I
doing wrong?
 
A

Allen Browne

The code from the MVPs webside article has to go in a standard module (i.e.
one created by clicking New on the Modules tab of the Database window.)

In your form, you can then use:
Me.CreatedBy = fOSUserName()
 
Top