Button to add current date

Button to add current date

Post by TWFye » Sun, 13 Feb 2005 04:31:06

I have several date fields on a form. In most cases, the date to be entered
is the current date. Is there a way I can add a button under each field that
when clicked will add the current date to that field? I've tried a few
variations, but can't get it to work. I don't want the default value to be
Now(), because a blank field indicates there is still work to be done.
Thanks! Mary

Button to add current date

Post by Tony Vroly » Sun, 13 Feb 2005 04:44:13

Instead if a button I would do it as a double-click on the date field but
either way works. I just don't like adding controls to a form unless I have
to. It keep things from getting too cluttered.

Private Sub txtDateField_DblClick(Cancel As Integer)
Me.txtDateField = Date()
End Sub

Tony V


Button to add current date

Post by Steve Scha » Sun, 13 Feb 2005 16:34:24


You may be interested to know that Access has a built-in keyboard
shortcut for this purpose. Press Ctrl+; to enter today's date.

Steve Schapel, Microsoft Access MVP