Re: Currentuser

From: Jim (
Date: 08/13/04

Date: Fri, 13 Aug 2004 13:15:15 -0700

Sandra. See my reply to Alex. Thanks for your help,
also. Between you both you've sorted my problem. This is
the first time I've been online and used a forum to solve
a problem, so I'm very impressed!
>-----Original Message-----
>Agreed - this code does not belong in the Enter event of
the Search_address
>control. It belongs in the BeforeUpdate event.
>As Alex has mentioned you could use the Default property
but this will only
>take care of entering the username of the user who
creates the record. It
>will not record the user that updates an existing record.
For this you must
>use the BeforeUpdate event.
>Sandra Daigle [Microsoft Access MVP]
>Please post all replies to the newsgroup.
>Alex Ivanov wrote:
>> Jim,
>> I would recommend to set a default value of the
search_address field
>> to CurrentUser()
>> and remove your event handler.
>> You may also consider moving your code to a different
event such as
>> BeforeUpdate
>> or check if the field is null before assigning it a new
>> The Enter event fires every time the text box receives
>> overwriting previous value.
>> This event fires also when you scroll the records while
control has
>> the focus.
>> <> wrote in message
>> news:5bef01c4813f$ae8570c0$a601280a@phx.gbl...
>>> Hi Sandra, thanks for the response. What I actually
>>> was this:
>>> I created a field in the table, called REGISTERED_BY.
>>> To one of the fields, SEARCH_ADDRESS, in the form (Not
>>> contiuous form, by the way) I attached the following
>>> Private Sub SEARCH_ADDRESS_Enter()
>>> REGISTERED_BY = CurrentUser
>>> End Sub
>>> When I enter the SEARCH_ADDRESS field on the
form, "Admin"
>>> is entered into the REGISTERED_BY text box, which is
>>> what I want. However, when I scroll through the rest
>>> the records, "Admin" has been entered in them as well -
>>> which isn't what I want. I've changed the code to
>>> Me. REGISTERED_BY = CurrentUser
>>> But the same thing happens. Hope this makes it
>>> Any more ideas? I'd really appreciate some help.
>>> Jim.
>>>> -----Original Message-----
>>>> Hi Jim,
>>>> It sounds like you are using a calculated control to
>>> display the current
>>>> user on a continuous form. If this is the case then
it is
>>> also likely that
>>>> nothing is getting saved in the table - it's only a
>>> display value.
>>>> Instead of putting an expression in the ControlSource
>>> the control you
>>>> need to bind the Control to a field in the table by
>>> putting (or selecting) a
>>>> fieldname in the ControlSource. Then in the
>>> event of the form,
>>>> assign the value to the control with a statement like
>>> this:
>>>> me.txtUserName=currentuser()
>>>> --
>>>> Sandra Daigle [Microsoft Access MVP]
>>>> Please post all replies to the newsgroup.
>>>> jim wrote:
>>>>> I would like to return the Current user to a field
in a
>>>>> record. However, when i try this, the current user is
>>>>> added to that field in every record, not just the
>>> current
>>>>> one. Can anybody help?
>>>> .

Relevant Pages

  • Re: FMily photo page
    ... i was plugging 8k chips into the daughter board just to get to 32, ... Alex wrote: ... >>>I am sorry to say that for the first time in over 25 years of operating ... > The Sony computer the drive is in has a Digital Video Recorder & I had ...
  • Re: FMily photo page
    ... So sorry Alex. ... >I am sorry to say that for the first time in over 25 years of operating ... > computers I have had a hard drive or HD controller failure Wednesday ... > photo page or the other pages on my Grampahugs web site. ...
  • Re: Question about Forever
    ... The first time (not counting the original death), the subway death, the ... cops got him as soon as he stepped out of the water. ... The second time we just saw Alex pick him up, ...
  • Re: What Did You Watch? 2010-10-13 (Wednesday)
    ... I probably missed it the first time because it was a ... 'Stevie' episode, ... and was distraught when Alex murdered ... Hellcats - A trifle of an episode, ...