CurrentUser()

B

Bill

Hi All,

I notice there is a variable called CurrentUser(). I would like to have this
value automatically added as the default value in a field in a table but
CurrentUser() does not appear in the expression builder list and I get an
error if I type it in.

Can anyone tell me where I am going please.

Ta.
Bill.
 
R

Rick Brandt

Bill said:
Hi All,

I notice there is a variable called CurrentUser(). I would like to
have this value automatically added as the default value in a field
in a table but CurrentUser() does not appear in the expression
builder list and I get an error if I type it in.

Can anyone tell me where I am going please.

Ta.
Bill.

CurrentUser() is only useful if you have applied user level security to your app
which forces all users to log in with a UserName and Password. If you haven't
done that then CurrentUser() will always return the same thing "Admin".

Code at the link below will return the Windows UserName currently logged into
the computer if you can use that instead...

http://www.mvps.org/access/api/api0008.htm
 
D

Duane Hookom

Keep in mind that this function can't be used as a default value of a field
in table design. You can use the function as a default in a text box on a
form.
 
B

Bill

..... and then presumably I can assign that value to another field on the
form???

BTW Rick missed the point!

And anyway I have enabled user level security.

Thanks anyway.
Bill.
 
D

Duane Hookom

I guess I am also missing your point. What exactly do you want to do with
the value returned by the function?

--
Duane Hookom
MS Access MVP
--

Bill said:
.... and then presumably I can assign that value to another field on the
form???

BTW Rick missed the point!

And anyway I have enabled user level security.

Thanks anyway.
Bill.
 
J

Joan Wild

In your forms include a textbox control bound to the field in your table
that will hold the username. Set the default value of that control to
=CurrentUser()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top