on dbl click.... "enter current time in shortTime format"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a bunch of bound textboxes that I want to be able to add the current
time when I double click on them. I have tried the =Now() command but I get
nothing. Is there a better expression to use, or a way to see if the command
is right but Access simply is not responding to it because I need to reload
the form?

Thanks,
 
MarcTA said:
I have a bunch of bound textboxes that I want to be able to add the
current time when I double click on them. I have tried the =Now()
command but I get nothing. Is there a better expression to use, or a
way to see if the command is right but Access simply is not
responding to it because I need to reload the form?

Create the following simple function in a standard module:

'----- start of code -----
Function SetToCurrentTime()

Screen.ActiveControl = Now()

End Function
'----- end of code -----

Now set the On DblClick property of each of those text boxes to:

=SetToCurrentTime()

That should do it.

Note that the Now() function returns a date/time value comprising both
the date and the time. If you want just the time -- or rather, the time
with the date set to 0 -- use the Time() function instead. You should
be aware, though, that *all* fields and values of the date/time type in
Access and VBA contain both a date portion and a time portion, whether
you use them or not.
 
Back
Top