It is the tables that your form and subform are bound to that get the update/edit info recorded.
As has been said, the BeforeUpdate event --or a data macro as DBG has just suggested, should do what you are asking.
It is the tables that your form and subform are bound to that get the update/edit info recorded.
As has been said, the BeforeUpdate event --or a data macro as DBG has just suggested, should do what you are asking.
You were advised to put the code in the form's BeforeUpdate event, and you put it in the form's Load event?????
This is what I have in some of my forms
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
Me.CreatedDate = Now()
Me.CreatedBy = Environ("username")
Else
Me.AmendedDate = Now()
Me.AmendedBy = Environ("username")
End If
End Sub
You were advised to put the code in the form's BeforeUpdate event, and you put it in the form's Load event?????
This is what I have in some of my forms
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
Me.CreatedDate = Now()
Me.CreatedBy = Environ("username")
Else
Me.AmendedDate = Now()
Me.AmendedBy = Environ("username")
End If
End Sub
Right, form should be dirty as soon as user enters data to any control. If you use code when form loads then a record edit is initiated. If user changes mind and closes form, you still have a record created unless you have button and code for user to cancel without saving.