Auto fill today's date when checkbox checked

S

Sunflower

Newbie question...

I have a checkbox and a date field in a subform...
How do I auto fill the date field with today's date when the checkbox
gets checked?

All help much appreciated
 
J

Jeanette Cunningham

Hi Sunflower,

In the after update event of the checkbox put code like this-->

Private Sub Me.NameOfCheckbox_AfterUpdate
If Me.NameOfCheckBox = True Then
Me.NameOfDateControl = Date()
End If
End Sub


Note: replace the obvious with the correct control names


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
S

Sunflower

Hi Sunflower,

In the after update event of the checkbox put code like this-->

Private Sub Me.NameOfCheckbox_AfterUpdate
If Me.NameOfCheckBox = True Then
    Me.NameOfDateControl = Date()
End If
End Sub

Note: replace the obvious with the correct control names

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia








- Show quoted text -

Thank you...works beautifully!!
 
Joined
Jun 21, 2017
Messages
1
Reaction score
0
What if the check box checked automatically?
I mean it already has an expression to be checked once other check boxes are checked?
Because in that way, the after update event doesn't work, since it's read only.
 

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