I am trying to write some 'if then else' code using date fields.
What I have managed to get working is:
If a date is entered into the "startdate" field then the "started" check box is marked.
What I can't work out how to do is use "null" in my code. Eg: if the date is a null value, the check box is unchecked. Naturally, but default, both the date field and check box are null; but occassionally I can see someone putting in a date by error and then deleting it. I've tried all sorts of permutations, but can't crack it.
I want the check box to be unmarked if the startdate value is null.
What I have managed to get working is:
Code:
Private Sub StartDate_AfterUpdate()
If StartDate.Value > #1/1/1900# Then
Me.Started.Value = True
End If
End Sub
If a date is entered into the "startdate" field then the "started" check box is marked.
What I can't work out how to do is use "null" in my code. Eg: if the date is a null value, the check box is unchecked. Naturally, but default, both the date field and check box are null; but occassionally I can see someone putting in a date by error and then deleting it. I've tried all sorts of permutations, but can't crack it.
I want the check box to be unmarked if the startdate value is null.