Reference to user names

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In my secured Access 2000 database I would like to register changes done to the data in the tables. Every user will log on with UserName, and I'd like to include this in the data tables. I'm thinking of fileds called ChangedBy and UpdatedAt (date)per record in my table, and the users are editing the table using forms. But how can I get to fill in UserName when a record is altered? - > Where/how does the VB code get access to which user is logged on?

Help would be greatly appreciated,
Ingrid
 
As long as all data changes occur via a form, you would use the form's
BeforeUpdate event.

Include the ChangedBy and UpdatedAt fields in the record source for the form
(they just have to be in the recordsource, not on the form).

In the BeforeUpdate event

Me!ChangedBy = CurrentUser()
Me!UpdatedAt = Now()

--
Joan Wild
Microsoft Access MVP

Ingrid said:
In my secured Access 2000 database I would like to register changes done
to the data in the tables. Every user will log on with UserName, and I'd
like to include this in the data tables. I'm thinking of fileds called
ChangedBy and UpdatedAt (date)per record in my table, and the users are
editing the table using forms. But how can I get to fill in UserName when a
record is altered? - > Where/how does the VB code get access to which user
is logged on?
 
Thanks a lot
It's a bit awkvard to see that when I search the help function for "current user", I find nothing on the subject... But as soon as I know the answer, and search for "currentuser" I get to see the CurrentUser Method topic..
Thanks again
Ingri

----- Joan Wild wrote: ----

As long as all data changes occur via a form, you would use the form'
BeforeUpdate event

Include the ChangedBy and UpdatedAt fields in the record source for the for
(they just have to be in the recordsource, not on the form)

In the BeforeUpdate even

Me!ChangedBy = CurrentUser(
Me!UpdatedAt = Now(

--
Joan Wil
Microsoft Access MV

Ingrid said:
In my secured Access 2000 database I would like to register changes don
to the data in the tables. Every user will log on with UserName, and I'
like to include this in the data tables. I'm thinking of fileds calle
ChangedBy and UpdatedAt (date)per record in my table, and the users ar
editing the table using forms. But how can I get to fill in UserName when
record is altered? - > Where/how does the VB code get access to which use
is logged on
 
Back
Top