How to just display the Time part of a Date/Time value?

N

Nathan

I've got an unbound form with three text boxes: one for the date, one
for a start time, and one for the end time. The Date box works just
fine. However, despite the fact that I have both time boxes set to use
the ShortTime format, when I click into the box, it shows the date as
well. For example, the box when loaded with data correctly shows
"11:00 AM", but when I click into the box it shows "1/1/1900 11:00:00
AM". I don't want the date part to be shown, as it will just confuse
people. How can I fix this?
 
J

Jeff Boyce

Nathan

If the field is defined as Date/Time, then it stores date and time, even
though you think you only have time in it. If you don't provide a
date-part, Access calculates that to be the first day (12/31/1899 or
1/1/1900, depending on what you're telling it to do).

If you want people to enter a "time-only" value, don't use the date/time
datatype. Use Text instead. Of course, then you'll have to "parse" it to
actually calculate time!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top