KenSheridan via AccessMonster.com said:
Terry:
Use an unbound check box (blank ControlSource property) and don't include
any
Boolean (Yes/No) field for it in the underlying table, just the Resolved
Date
field of date/time data type. To have both fields in the table would
introduce redundancy and leave the table open to inconsistent data.
In the form's Current event procedure set the value of the check box on
the
basis of there being a value in the Resolved Date field:
Me.[chkResolved] = Not IsNull(Me.[Resolved Date])
In the check box's AfterUpdate event procedure update the value of the
Resolved Date field with code like Al's, e.g. to insert the current date
with
no time of day:
If Me.chkResolved Then
Me.[Resolved Date] = VBA.Date
Else
Me.[Resolved Date] = Null
End If
BTW if you do this in a continuous form put the unbound text box in the
form
header, not in the detail section. Otherwise its value would change in
every
row as you move between rows as you'd really just be seeing multiple
instances of the same check box.
How about binding the check box to the expression,
=([Resolved Date] Is Not Null)
so that always reflects the state of the current record, even on a
continuous form, without any code in the form's Current event? Then put a
transparent command button on top of the check box, and create an event
procedure for that button like this:
Private Sub cmdToggleResolvedState_Click()
With Me.[Resolved Date]
If IsNull(.Value) Then
.Value = Date
Else
.Value = Null
End If
End With
End Sub