Share via

Date Time stamp command button

Anonymous
2019-12-13T19:54:35+00:00

Hi, 

I'm working to create a project time table that documents the number of hours I spend on a particular task - for all intensive purposes, a time clock.  I've created 2 command buttons, one for starttime and the other, stoptime. For the life of me I'm unable to figure out how to connect the command buttons to the text fields. The date picker has been updated in the table to "never" & default is Now().  Any help would be much appreciated. 

Thanks, Ann

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Duane Hookom 26,825 Reputation points Volunteer Moderator
2019-12-13T20:04:52+00:00

Since it looks like your buttons are in the header or on the main form, I would just use the double-click event of the StartTime or StopTime to set the value to either Time() or Now() depending on if you want the time to include the date portion. The code would be something like:

Private Sub StartTime_DblClick(Cancel As Integer)

Me.StartTime = Time()

End Sub

Replace the command buttons with a label with the caption "Double-Click to enter current time".

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2019-12-13T21:57:20+00:00

    That got it, thank you so much for the quick reply. Since it's a double click I did not add labels.

    Many thanks again! Ann

    Was this answer helpful?

    0 comments No comments