I am trying to set my form so that as soon as a field on the main form or in the sub-form is changed, the LastModifiedDate is automatically changed to today's date.
The LastModifiedDate has the following:
Date Type = Date/Time
Default Value = Date()
Validation Rule = <= Date()
Validation Text = Last Modified Date cannot be greater than today.
This is the code I have written in the Form_frmClients(Code) window:
Private Sub Form_AfterUpdate()
If Me.Dirty = False Then
[LastModifiedDate] = Date
End If
End Sub
I can tab to different fields, and I think it's when I tab off of the Modified date field that it changes. But now I can't got to another records. A message box appears saying "You can't go to the specified record." This happens when I try to go forward or backward. If I try to close out of the form completely, a message box appears saying "You can't save this records at this time. Microsoft Access may have encountered an error while to save a record. If you close the object now, the data changes may be lost...." If I choose to close the form anyway and then open it up again, the information that I added is still there and has not been lost.
And just as a side note....why is it Me.Dirty = False? I would think it would be True since I am looking for changes.
Thanks!
The LastModifiedDate has the following:
Date Type = Date/Time
Default Value = Date()
Validation Rule = <= Date()
Validation Text = Last Modified Date cannot be greater than today.
This is the code I have written in the Form_frmClients(Code) window:
Private Sub Form_AfterUpdate()
If Me.Dirty = False Then
[LastModifiedDate] = Date
End If
End Sub
I can tab to different fields, and I think it's when I tab off of the Modified date field that it changes. But now I can't got to another records. A message box appears saying "You can't go to the specified record." This happens when I try to go forward or backward. If I try to close out of the form completely, a message box appears saying "You can't save this records at this time. Microsoft Access may have encountered an error while to save a record. If you close the object now, the data changes may be lost...." If I choose to close the form anyway and then open it up again, the information that I added is still there and has not been lost.
And just as a side note....why is it Me.Dirty = False? I would think it would be True since I am looking for changes.
Thanks!