Currentuser () as default value in table?

D

Douglas J. Steele

AFAIK, you can't. You can, however, make it the default for a form field
bound to a field in the table.
 
J

John Nurick

Hi Henro,

It can't be done in an Access table. Instead, ensure that all data entry
is done via a form, and set the default values there.
 
D

david epsom dot com dot au

You can only use SQL or VBA expressions for the default value.

CurrentUser is a method of the Application Object,
so you can't use that.

However, you can use

=Environ("UserName")

as a default value.
Environ is a VBA inbuilt function. You can also use
Command(), CurDir() etc. You may even be able to
work out how to use SetOption to set the 'command line
argument' option in Access. These VBA default values
don't work exactly like SQL default values: if you open
a derived query you won't see the default value until
you start typing in the new record.

To see the environment variables on your PC, open a DOS or
CMD prompt window and type SET.

If your environment does not have a "UserName" set, or if
you wish to use your own value, you may be able to set an
environment value by using a Win API or a Shell object.

This is not a secure method, because users generally are
able to change the environment options.

(david)
 
J

John Nurick

Use a form, and make it the default value for the textbox you use to
display the field.
 
J

John Nurick

Hi Henro,

It can't be done. Instead, do your data entry via a form with a textbox
bound to the field, and set the textbox's Default Value to
=CurrentUser()
 
H

Henro

I am trying to make CurrentUser () the default value for a TEXTfield in a
table. How can I do this?

TIA HENRO
 

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

Similar Threads


Top