MS Access 2003 and 2007 Add a checkbox then automatically update the date field with the current date

Need to know how to add a checkbox, and when the check box is checked, insert current date into the date
field box.  How do I do the statement in the expression builder?
Who is Participating?
Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:
Add a checkbox to the from
Then use code like this to insert the date:

Sub YourCheckBox_AfterUpdate()
    If me.YourCheckBox=True then
    end if
End sub

You will, of course, have to modify this and add your specific data entry validation rules.

friskeeAuthor Commented:
It's not working- here's the code:
Sub ChkSold_AfterUpdate()
If Me.ChkSold = True Then
        Me.txtSoldDate = Date
    End If
End Sub

txtSoldDate control source is the sale date field in my sale table
txtSoldDate is the name
What else could I be doing wrong?
Jeffrey CoachmanMIS LiasonCommented:
This is fairly standard code.
I can't see a reason why it might not work.

Please Post a sample of this database.

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

friskeeAuthor Commented:
I tried it again.  IT WORKS-  thank you that answer was straight forward and simple.  increased points
come back and answer me anytime-
friskeeAuthor Commented:
Simple fast response- Wonderful!
Jeffrey CoachmanMIS LiasonCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.