Timestamping

dgmorr

Registered User.
Local time
Today, 10:07
Joined
Jan 10, 2007
Messages
71
Hey guys,

Is there a way to timestamp each entry on a memo field on a form when it has been changed?
 
Search for "Audit Trail" there is an excellent example posted.

Col
 
I need to do this too. I've searched "Audit Trail" but cannot find what I need. Any ideas?
 
Inserts Date/Time into note field
Code:
Private SubYourMemoControlName.Value_GotFocus()
If IsNull(YourMemoControlName.Value) Then
    Me.YourMemoControlName.Value = Now() & ":  "
    Me.YourMemoControlName.SelLength = 0
Else
    Me.YourMemoControlName.Value = Me.YourMemoControlName.Value & "  " & Now() & ":  "
    Me.YourMemoControlName.SelStart = Len(Me.YourMemoControlName.Value) + 2
End If
End Sub

Does the same thing but inserts a new line first so each entry starts on its own line
Code:
Private SubYourMemoControlName.Value_GotFocus()
     Me.YourMemoControlName.Value = Me YourMemoControlName.Value & vbNewLine & " @ " & Now() & " : "
End Sub

I used the GotFocus event in these examples, because I deal with medical records, and I can't have users editing previous entries. If they need to correct a previous entry, they need to mark the note as a correction or addendum with the change timestamped. You can use other events, depending on your wants/needs, such as the box's DoubleClick event. This would allow the user to edit previous entries without time stamping it, or timestamp it by double-clicking first the typing.
 
Thanks for the help, but I can't seem to get this working. What does the Me refer to?
 
ME can be thought of as shorthand for the name of the form you're working in.

Me.YourMemoControlName

is the same as

YourFormName.YourMemoControlName

In the code example above, you have to substitute the actual name of your memo box control for YourMemoControlName

Which event did you place the code in?
 

Users who are viewing this thread

Back
Top Bottom