Hi Neil,
You can put code in the Before Update event of the form to do this.
Put it at the end of any validation code in the before update event.
It is 99% effective. If a user makes an edit then presses Esc to cancel the
edit, access still treats the form as if it is dirty.
Here is the code.
Me.LastUpdate = Now()
If you want to be sure that you only save LastUpdate when there is a real
change to data, you can use something like-->
If Me.ControlName1 <> Me.ControlName.OldValue1 _
& Or Me.ControlName2 <> Me.ControlName.OldValue2 Then
Me.LastUpdate = Now()
End If
Replace ControlName1 and 2 with the names for your form.
If you have a lot of controls on your form, you can use something like
this-->
Public Function RealChangeCheck(frm As Form) As Boolean
'check if ctl values are changed
Dim ctl As Access.control
For Each ctl In frm.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox, acCheckBox, acListBox
'Debug.Print ctl.Name & ": " & ctl
If Not ctl.Locked = True And ctl.Visible = True Then
If frm.NewRecord = True Then
If Len(ctl.Value & vbNullString) > 0 Then
RealChangeCheck = True
Exit For
End If
Else
If ctl.Value <> ctl.OldValue Then
RealChangeCheck = True
Exit For
End If
End If
End If
End Select
Next ctl
End Function
You call this function in the before update of the form like this-->
If RealChangeCheck(Me) = True Then
Me.LastUpdate = Now()
End If
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia