Automatic assigning the user ID to a field in table

C

Cihat Mus

I have a small access databese on a shared computer for entering data. Each
user has their own user ID's and passwd's.
In the table, the fields and types are:

Field_Date: Now()
Field_Comment: Text
Field_User: Text - Combo Box (Users choose their names from the combo box
and finish the action)

I want to prevent users entering records instead of other users. How can I
assign user names automatically to the field in a table or form?
 
J

Joan Wild

You can't do it in a table, but you can in a form. If you want to set the
username when the record is created, you can set a default of CurrentUser()
on a control bound to your Field_User field. If you want to update that
field if the user makes a change to an existing record, you can use the
BeforeUpdate event for the form to set the Field_User field to
CurrentUser(). In either case, the Field_User field/control doesn't have to
be visible on the form.

Me.[Field_User] = CurrentUser()
 
Top