on click = yes

C

cjgav

Hi
I would like the value of a yes/no field to change to yes on click of this
field in a form then update the value of a date field in the same form to
todays date.
Can anyone help with the code for this:?

Regards
Colin
 
K

Ken Snell [MVP]

What if the user wants to unclick the checkbox?

To always have a click mean "yes":

Private Sub NameOfCheckboxControl_Click()
Me.NameOfCheckboxControl.Value = True
Me.NameOfDateField.Value = Date()
End Sub
 
B

Bernard Peek

Steve said:
Put the following in the click event:

Me!NameOfYesNoField = "Yes"

You may prefer

Me!NameOfYesNoField= not Me!NameOfYesNoField

This causes the field to toggle back to No if the field is clicked
again.
 
C

cjgav

Hi Ken
That works fine . Thanks for that.

Ken Snell said:
What if the user wants to unclick the checkbox?

To always have a click mean "yes":

Private Sub NameOfCheckboxControl_Click()
Me.NameOfCheckboxControl.Value = True
Me.NameOfDateField.Value = Date()
End Sub

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/
 
Top