Leading zero for hours fails

  • Thread starter Thread starter Lars Brownies
  • Start date Start date
L

Lars Brownies

A2003: In a table and a form I use the dd-mm-yyyy hh:nn:ss format but when
the number of hours is for instance 9 it shows 9 in stead of 09.
Any ideas on how to resolve this?

Thanks,

Lars
 
Lars Brownies said:
A2003: In a table and a form I use the dd-mm-yyyy hh:nn:ss format but when
the number of hours is for instance 9 it shows 9 in stead of 09.
Any ideas on how to resolve this?


Huh. I see that, and it certainly doesn't seem to match what the format
specifies. If you don't need to be able to update the value, you can use
the Format function for a calculated field or control; this does seem to
give the leading 0 on the hours:

Format([DateTimeField], "dd-mm-yyyy hh:nn:ss")
 
I suppose you could extract the pieces separately, as text, do an iif to
precede the hours with a "0" if it's just one digit, and then concentate them
all.
 
In this case updating doesn't happen in the form, so your solution works
well.
Thanks.

Lars

Dirk Goldgar said:
Lars Brownies said:
A2003: In a table and a form I use the dd-mm-yyyy hh:nn:ss format but
when the number of hours is for instance 9 it shows 9 in stead of 09.
Any ideas on how to resolve this?


Huh. I see that, and it certainly doesn't seem to match what the format
specifies. If you don't need to be able to update the value, you can use
the Format function for a calculated field or control; this does seem to
give the leading 0 on the hours:

Format([DateTimeField], "dd-mm-yyyy hh:nn:ss")

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top