Current User

  • Thread starter Thread starter mmazenge
  • Start date Start date
M

mmazenge

Hi,

I have two users confiming one operation on my database and i need to
track the user by defaulting to the current user() i.e. logged on user.
Now setting the default value to Current User() only works if its a new
record, but i want it to work when editing as some of the data would
have been captured by some other user.

Thanks in advance

Memory
 
Use the BeforeUpdate event of the *form* to record the name of the current
user into your field.

This example assigns the current user to the field named UpdatedBy:
Private Sub Form_BeforeUdpdate(Cancel As Integer)
Me.[UpdatedBy] = CurrentUser()
End Sub
 
Thanks but this will update the database, how will i then default the
value on the capturing form. My issue here is i ahve user A & B, doing
the same job and we need to track delays of certain documents i.e. an
order is approved by the finance department and User A may take 3 weeks
to place that order and then uses User B's credentials and i want to
avoid that.
How then can I default to CurrentUser() during editing??

Thanks

Regards

Memory
 
I don't understand. Comments in-line.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Thanks but this will update the database

You don't want to save the name of the current user who last changed the
record?
, how will i then default the
value on the capturing form.

The user does not have to see the field or enter anything. The value is
automatically inserted when the Form_BeforeUpdate runs.
My issue here is i ahve user A & B, doing
the same job and we need to track delays of certain documents i.e. an
order is approved by the finance department and User A may take 3 weeks
to place that order and then uses User B's credentials and i want to
avoid that.

If the field not shown to the user, but assigned programmatically to the
field, you are still worried that the user may change this?
How then can I default to CurrentUser() during editing??

By using the BeforeUpdate event of the form?
 
Back
Top