Leading zero for hours fails

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
 
D

Dirk Goldgar

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")
 
F

Fred

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.
 
L

Lars Brownies

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)
 

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