truncated date display

  • Thread starter Thread starter Samuel Lee
  • Start date Start date
S

Samuel Lee

When I display or copy short time and short date fields
the leading zeros are lost. 08/08/03 becomes 8/8/03. How
can I preserve the zeros. I've tried setting the format on
the query to mm/dd/yyyy, and it appears correct in
datasheet view, but when I display the form the zeros are
lost.
 
Samuel Lee said:
When I display or copy short time and short date fields
the leading zeros are lost. 08/08/03 becomes 8/8/03. How
can I preserve the zeros. I've tried setting the format on
the query to mm/dd/yyyy, and it appears correct in
datasheet view, but when I display the form the zeros are
lost.

Format properties generally don't propagate. Apply the format you want on the form
itself.
 
Thanks for the reply, Rick. I tried changing on the form
but when I enter hh:mm in format properties, it defaults
to short date, which in turn leaves off the zeroes--same
with date field. Any ideas how to force the format to
hh:mm and mm:dd:yyy?
 
Oops. I see why it was defaulting to Short Date (should
use nn instead of mm for minutes), but when I try hh:nn
the hours still lose the zeros.
 
Sam said:
Thanks for the reply, Rick. I tried changing on the form
but when I enter hh:mm in format properties, it defaults
to short date, which in turn leaves off the zeroes--same
with date field. Any ideas how to force the format to
hh:mm and mm:dd:yyy?

An explicit format (not a named one) that includes "mm:dd:yyyy" should include
leading zeroes for the day and month values. You're correct though that for some
reason Access does not accept an explicit format that retains leading zeros for
hours. I have never understood that.

If you don't need to be able to update the data, you can use the Format() function to
return a String with leading zeros on the hours.

Format([DateField], "mm-dd-yyyy hh:nn")
 
Back
Top