Saving Login Id on each record

K

KathyV

I have an access database using vba with sql tables. I want to add a field
that will automatically update with the userid of the person entering the
record. Any suggestions on code and how to retrieve login name.
 
S

Sean

an easy and quick way..... on the "Before Insert" event of the FORM
Me.CREATE_TS = Now()
Me.CREATE_ID = UCase(Environ("USERNAME"))

Of course CREATE_TS and CREATE_ID are fields in the table. I also have A
UPDATE_TS AND UPDATE_ID on the tables which are updated on the "Before
Update" Event of the Form.
 
D

Douglas J. Steele

I always recommend very strongly against using the Environment variable.
It's trivial to reset Environment variables. Go the API route.
 
Top