>I am attempting to have the status of a checkbox dictate what appears in a
>particular text box. I used to the following code:
[quoted text clipped - 11 lines]
>checked and then unchecked? Comment 2 should only appear if the checkbox
>was never checked.
You'll need to store the value Comment 1 or Comment 2 in a table in
order for Access to "remember" whether it has EVER been changed.
Remember, a checkbox or a textbox on a form *is not* a data storage
medium - it's a data *display* medium! Data is stored in Tables, and
only in Tables.
That said, you can use code like this to do what you describe. I'm
assuming you're on a Form, with controls chkMyCheck bound to the
yes/no field in your table, and txtComment bound to the comment field.
Select chkMyCheck's AfterUpdate event, click the ... icon by it, and
invoke the Code Builder:
Private Sub chkMyCheck_AfterUpdate()
If Me!chkMyCheck = True Then
Me!txtComment = "Comment 1"
End If
End Sub
If you set the Default Value property of txtComment to "Comment 2" new
records will be set to that value; the AfterUpdate event will
overwrite it if the user checks the checkbox, and leave it alone if
they clear it.
John W. Vinson[MVP]