Auto updating a field with today's date upon modification??

  • Thread starter Thread starter textures2
  • Start date Start date
T

textures2

Guest
Hi Access-heads;

I'm trying to add a field to a table of data that will automatically update itself (i.e. a date_modified value) with today's date if any field in the record is modified.

Does anyone know what the best method of implementing this is? So far the only method I've found is by making some change to the form which modifies the data and making it set that field = date() upon some action (i.e. click, data entered, etc.)

Help!

./peter
 
I use the below code and grab the NT user ID while at it

Option Compare Database
'Masterform LastEditedBy code
'Benjamin Linville
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetNTUser() As String
On Error GoTo Err_GetNTUser
Dim strUserName As String
strUserName = String(100, Chr$(0))
GetUserName strUserName, 100
strUserName = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)
GetNTUser = StrConv(strUserName, vbProperCase)
Exit_GetNTUser:
Exit Function
Err_GetNTUser:
MsgBox "GetNTUser", Err.Number, Err.DESCRIPTION
Resume Exit_GetNTUser
End Function

'Each field that can be edited gets tagged with
Private Sub Account___AfterUpdate()
Me.LastEditedBy.Value = GetNTUser & " " & Date & " " & Time
End Sub
 

Users who are viewing this thread

Back
Top Bottom