Date and Time code

zeidhaddad

New Member
Joined
Oct 4, 2019
Messages
14
i'm looking for a vba code where i can click the command button to add the exact date and time Now() smthn like this ? any idea ?
 

stumac

Active Member
Joined
Jul 16, 2010
Messages
470
if you have a control for the date and time on the same form to add the date and time you should be able to set it on the On click event

Code:
Private Sub [COLOR=#ff0000]MyButton[/COLOR]_Click()
Me[COLOR=#ff0000].MyField[/COLOR] = Now
End Sub

changing the names of the controls to your control names.

You can user the format function to format the now function as required.
 
Last edited:

Forum statistics

Threads
1,077,649
Messages
5,335,473
Members
399,017
Latest member
npatel917

Some videos you may like

This Week's Hot Topics

Top