My minutes box doesnt show the leading zero

G

Guest

I have created a table with seperate entries for hours and minutes, which
default at the current time. However, the minutes box displays the time as a
single digit if there is a leading zero, so that when i combind the boxes
later, it looks odd, eg, 15:7 instead of 15:07.

So, is it possible to get the table to automatically add the leading zero?
I am working on Access 2003.
 
J

John Vinson

I have created a table with seperate entries for hours and minutes, which
default at the current time. However, the minutes box displays the time as a
single digit if there is a leading zero, so that when i combind the boxes
later, it looks odd, eg, 15:7 instead of 15:07.

So, is it possible to get the table to automatically add the leading zero?
I am working on Access 2003.

You can use the Format() function in combining them:

=[Hours] & Format([Minutes], "\:00")


John W. Vinson[MVP]
 
T

Tim Ferguson

=?Utf-8?B?Um9iIHRoZSBhbWF0ZXVy?=
However, the minutes box displays the time as a
single digit if there is a leading zero, so that when i combind the
boxes later, it looks odd, eg, 15:7 instead of 15:07.


you can put them both into one textbox by putting something like this in
the controlsource:

=Format([ElapsedMins],"00") & Format([ElapsedSecs],"\:00")

or you can put them into two text boxes each with the Format property set
to "00"

You could even just have one field for ElapsedSecs and display it like
this:

=Format([ElapsedSecs]\60,"00") & Format([ElapsedSecs] mod 60, "\:00")

Hope that helps


Tim F
 

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