CurrentUser to update into table field

G

Guest

I have a field on my Main table called Username. My data entry form
automatically fills in the name of the CurrentUser, with =CurrentUser() in
the RecordSource. The CurrentUser is their Access user name. When that user
enters a data item into the form, the form enters the record into all the
relevant fields in the Main table with the exception of Username; for some
reason that one comes up blank. How do I fix this? Thank you.
 
D

Douglas J. Steele

How are you getting the CurrentUser into the field: as the ControlSource, or
the DefaultValue?

If it's the ControlSource, then it's not actually bound to the field in your
recordsource, hence the field never gets updated.
 
V

Van T. Dinh

If you use *exactly* as you posted (=CurrentUser()) in the ControlSource (I
am guessing that is what you meant by RecordSource) of the TextBox, then it
is a calculated Control, NOT a bound Control and therefore, the value won't
be updated into the Table.

Try using:

* The Table Field Name (which must be in the RecordSource of the Form) as
the ControlSource.

and

* In DefaultValue, use:

CurrentUser()

Note: This assumes that you are using Access Security since otherwise, every
user is the user "Admin".
 

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