auto populate user id (1 Viewer)

dkirk02

Registered User.
Local time
Today, 01:56
Joined
Jan 26, 2001
Messages
38
I have a multiuser database on our WAN here at work. I am wondering if anyone could help me out on autopopulating the user id on a form, thus writing it to the table. I have heard that this can be done when you have a user work group in place, but the example db that I have to go by gives no indication in the field properties or in the code that would explain how this is done. In the old db, the field is simply an unbound control with no table/field referenced in the control source.
Any thoughts?
 

Matthew Snook

NW Salmon Database
Local time
Today, 01:56
Joined
Apr 19, 2001
Messages
133
From Access help:

CurrentUser Method


You can use the CurrentUser method to return the name of the current user of the database.

For example, use the CurrentUser method in a procedure that keeps track of the users who modify the database.

Syntax

CurrentUser

Remarks

The CurrentUser method returns a string that contains the name of the current user account.

If you haven't established a secure workgroup, the CurrentUser method returns the name of the default user account, Admin. The Admin user account gives the user full permissions to all database objects.

If you have enabled workgroup security, then the CurrentUser method returns the name of the current user account. For user accounts other than Admin, you can specify permissions that restrict the users' access to database objects.

The following example obtains the name of the current user and displays it in a dialog box.

MsgBox("The current user is: " & CurrentUser)...


I tried it, works well. Just create an unbound text box, and put

=[CurrentUser]

into the "Default Value" slot in properties. Voila, or whatever.

Matt
 

dkirk02

Registered User.
Local time
Today, 01:56
Joined
Jan 26, 2001
Messages
38
Thanks, that worked like a charm!
 

Users who are viewing this thread

Top Bottom