Re: adding logged in user to text box

From: Rick B (anonymous_at_discussions.microsoft.com)
Date: 06/07/04


Date: Mon, 7 Jun 2004 09:55:11 -0500

I am not sure why you'd want to do this on a button press. What if the user
does not press the button? You should simply write the timestamp anytime
the data is changed. If you want to only track the most recent change,
you'd just place the data in a field. something like...

Private Sub Form_BeforeUpdate(Cancel As Integer)

    If Me.Dirty Then
        If (Nz(Notes.OldValue, 0) <> Nz(Notes.Value, 0) Then
            Me.Timestamp = Format(CurrentUser, ">") & " " & date & " " &
Time
        End If
    End If

End Sub

If you want to retain an audit trail, there are examples out there on the
web. I know Allen Browne has some code on his website that does it nicely.

Rick B

"dennis" <anonymous@discussions.microsoft.com> wrote in message
news:990184B3-20A1-4388-AA63-2C89CD10C934@microsoft.com...
What I want to do though is keep a record of who has made changes within the
notes part of the database. We would like to have a button on the form that
when pressed would display the current user, the date and the current time
within a textbox (Notes). Right now I am able to display the time, but the
others (date and currentuser) are overwritten by the time. When I try to
enter data into the database, it will let me add the text, but if I try to
add the current date, time and user, it will overwrite anything that I have
entered and display the time. Is there a way to display all three (date,
time, and user) all at once and is it possible to press the butoon to get
these displayed, add text and then say 2 days later, go back into the
database press the button, have the time, date, and user added to the end of
the info previously inputted into the textbox, then add more text. All
within the same record, instead of having to start a new record for the same
customer? This way, we can have multiple entries in the one textbox (Notes).
For example the one textbox, it may look like this.

Quote:
----------------------------------------------------------------------------

----
Dennis June 12th, 2004, 10:30am        ' first entry
text here
Dennis June 20th, 2004, 1:00pm         ' second entry
text here
Dennis July 1st, 2004, 3:15pm            ' third entry
text here
----------------------------------------------------------------------------
----
This is all in one textbox.
Thanks
Dennis