I have a field on which I like to perform some data validation before the record is saved (regardless of either it's an new or existing record).
The logic is this: If Closed is not null, then resolution and notified must not be null (have zero length protection at table level).
My code is as follows on the form BeforeUpdate event:
Seems to work ok on initial data entry into the Closed field -- it triggers if Resolution OR Notified is null. However, if you navigate away from the record, come back and delete values from Resolution and navigate away, it doesn't fire. If it's any help, the Resolution field is a memo field.
This doesn't happen with the Notified field (numeric).
Advice or pointers in the right direction would be much appreciated.
The logic is this: If Closed is not null, then resolution and notified must not be null (have zero length protection at table level).
My code is as follows on the form BeforeUpdate event:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Check that resolution and notified have been entered before saving record
If Not IsNull(Me![Closed]) Then
If IsNull(Me![Resolution]) Or IsNull(Me![Notified]) Then
MsgBox "You may not close an item without a resolution and notified method!"
Cancel = True
End If
End If
End Sub
Seems to work ok on initial data entry into the Closed field -- it triggers if Resolution OR Notified is null. However, if you navigate away from the record, come back and delete values from Resolution and navigate away, it doesn't fire. If it's any help, the Resolution field is a memo field.
This doesn't happen with the Notified field (numeric).
Advice or pointers in the right direction would be much appreciated.