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
 
S

Steve

Put the following in the click event:

Me!NameOfYesNoField = "Yes"
Me!NameOfDateField = Date()

Steve
(e-mail address removed)
 
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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top