Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"update" username to memo field after update 2

Status
Not open for further replies.

shelron

Technical User
Apr 9, 2002
135
US
Access 2000, I am trying to record the users name and date when they make a change to a memo field.

The rub is that the memo field may contain many instances of changes, and I want to keep all of them for a running record.

So what I think I need to do is first save the users entry, then string it to the time and date?? I don't know how to caputure the input, then add it all back into the field?

Any help would be appreciated. Ron








Private Sub cofundcomm_AfterUpdate()

'record user name, date and time of the change to the record


Dim userid As String


userid = Environ("UserName")
cofundcomm = userid & " " & Now()




End Sub
 
Actually:

Sub Form_BeforeUpdate(Cancel As Integer)
Me("MemoField")=Me("MemoField") & CurrentUser() & "(" & Now & "); "
End Sub

HTH
[pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
What I do for situations like this is have two text boxes on the form. One shows the old text in the memo field and the other starts out blank. The first one is not editable, the second one is. When the record is saved, everything in the second one gets prepended to the text in the memo box, preceed with the username and the date.

Here's a function that I use to do this work. This uses my error handling and a global variable instead of currentUser, but should be easy to adapt to what you need. Before the record gets saved, just make the text box bound to the memo field equal to this function (with the appropriate parameters).

(Watch for line-wrap issues)

Function AppendNotes(strNewNote As String, strOldNote As String) As String
'(c)Copyright 8/30/02 Jeremy Wallace, AlphaBet City Dataworks, jeremy@ymerej.com
On Error GoTo Error

AppendNotes = Format(Date, "dd-mmm-yyyy") & " " & sUser & ":" & vbCrLf _
& strNewNote & vbCrLf & vbCrLf & "==========" & vbCrLf _
& strOldNote

ExitPoint:
On Error Resume Next

Exit Function
Error:
Select Case Err.Number
Case Else
Call ErrorTrap(Err.Number, Err.Description, "AppendNotes")
End Select
GoTo ExitPoint
End Function
=============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Thanks,

I went with Daniels solution for now, going to look into Jeremys too.

Me the rookie, really appreciates your help,

Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top