Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time picker 1

Status
Not open for further replies.

ghacig

Technical User
Sep 24, 2004
60
0
0
US
I am using the MS Date and Time picker to fill the time in a control. However, I don't need the date, all I need is the time. Is there any way I can do that. Or, are there other ways to pick time.

Control name: SzTime
date and time picker: SzTimePicker

This is the code I am using:

SzTime.value = SzTimePicker.value

Thanks.
 
Try this:

SzTime.value = Format(Me.SzTimePicker, "HH:MM:SSAMPM")

You can set another format if this is not the format that you would like.

Alternatively, you could set the SzTime control's format to a variation of hh:mm:ss. It will store the date and the time but will only display the time.

HTH,
Eric
 
Thanks a lot. It works.

I still have one problem. I set the format in the custom property of the Date and Time picker to 3-dtbcustom and set the customfromat to "HH:mm:ss". It works when I open the form, then it revert to showing me the date instead of the time.

Any ideas?

Thanks.
 
Don't know if I'm thinking along the right lines...but:

When I want to see the time in a form control, or input the time to a field, I sometimes use this:

=Right(Now(),8)

This extracts the right 8 characters (which is the time) from the current date and time (which is Now()).

-If you use this to write to a field, I reckon you'd want it to have a 'text' datatype.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top