Audit trail

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a memo field that I want to append a date and time and note to every
time the user presses a button i.e. 11/04/07 15:34 usera button 1 pressed,
12/04/07 15:30 userb button 2 pressed etc.

At present I have Me.customerhistory = Now() & "Button 1"
 
Should add I have

Me.customerhistory = Me.customerhistory & vbNewLine & Now() & " Letter 1
issued"

just need the user part.
 
Have resolved.

I used the module:

Public Function libUserName() As String
' Returns the Username defined by the environment variable USERNAME
' otherwise returns the current Access user

On Error Resume Next

Dim strUserName As String

strUserName = Environ("USERNAME")
If strUserName = "" Then
strUserName = CurrentUser()
End If
libUserName = strUserName
End Function

Then wrote:

me.username.setfocus
username = libUserName

Me.customerhistory = Me.customerhistory & vbNewLine & Now() & " Letter 1
issued" & " " & [Username].

Marshall Barton said:
What/where is "user part"?
--
Marsh
MVP [MS Access]

Should add I have

Me.customerhistory = Me.customerhistory & vbNewLine & Now() & " Letter 1
issued"

just need the user part.
 
fishy said:
Have resolved.

I used the module:

Public Function libUserName() As String
' Returns the Username defined by the environment variable USERNAME
' otherwise returns the current Access user

On Error Resume Next

Dim strUserName As String

strUserName = Environ("USERNAME")
If strUserName = "" Then
strUserName = CurrentUser()
End If
libUserName = strUserName
End Function

Then wrote:

me.username.setfocus
username = libUserName

Me.customerhistory = Me.customerhistory & vbNewLine & Now() & " Letter 1
issued" & " " & [Username].


Ahh, that's looks fine with the caveat that the Environ
values are unreliable because it can be changed easily.

Maybe you are serving another objective, but from what
you've said so far, I don't see a need for the line:
me.username.setfocus
 
Back
Top