Update Table with User Name

  • Thread starter Thread starter C#''er
  • Start date Start date
C

C#''er

I have created a form (on the FE) that is linked to a table (on the BE). In
this form there are a number of fields, one of which uses a Macro that
returns the network login name of the user. However, the value in this text
box is dosent update inside the table. How can I get this value stored in the
table I am using?
 
Just put the code in the forms before update event.. (it only fires if the
form data is changed).

So,

me!Username = nameOfFunctionThatReturnsUserNameGoesHere()
 
Im sorry, I failed to mention that I am somewhat of a novice using Access to
code. I did try your suggestion though, but to no avail. The "Recieved By"
columm in the table still does not update with the user name (function name
is "username()"
 
You will need to bind the text on the form to the table field if this is a
bound form. Otherwise there is code behind the form that is updating the
table in question and that field is not included.
 
It is a bound form. Other fields on the form are text entry fields. With
these fields i dont have any problems with the updating of the table. They
are entered into the table just fine. for the other fields on the form I have
the control sorce equal to the matching field in the table. However, as the
control source of the 'recieved by' field, i have a function which returns
the network ID of the current user. This field is never saved onto the table.
 
You can do one of two things. You can add a control on the form that is
bound to a field in the form's record source and populate the control with
the user name or you can use a query to update the record.
 
Therein lies your problem. A control can have only one control source. To
update to the table, it needs to be bound to a field in the table.
 
Back
Top