First off, to test whether or not a
Control has been left blank (
Null) you need to use the
Form_BeforeUpdate event. Using the
OnExit or
LostFocus event of the
Control is useless for this; to defeat the testing the user merely has to not bother to enter the
Control.
Also, you need to check for
Null, as well as a
Zero-Length String (
"".) There are a number of ways to do this...everyone has a favorite. For this I would generally use
If Nz(Me.ExpireDate, "") = "" Then
This should do what you need:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Nz(Me.ExpireDate, "") = "" Then
Me.Inactive = "Inactive"
End If
If Me.ExpireDate > Date Then
Me.Inactive = Null
End If
End Sub
Linq
;0)>