A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Format Property bug: "hh" doesn't display leading zero



 
 
Thread Tools Display Modes
  #1  
Old August 17th, 2006, 12:22 PM posted to microsoft.public.access.forms,microsoft.public.access.reports
[email protected]
external usenet poster
 
Posts: 8
Default Format Property bug: "hh" doesn't display leading zero

A number of closed topics deal with problems displaying military time
with various suggested solutions, but none of the discussions I have
seen mention that the the underlying problem seems to be a bug in
Access' Format Property.

I was unable to find a discussion of this problem in the Microsoft
Knowlege Base.

Military time (and many scheduling and dispatching applications) always
displays 24 hours with a leading zero for hours less than 10, e.g.,
"08/17/2006 05:35"

Contrary to its documentation, the Microsoft Access Format Property
does not display a leading zero for times with hours less than 10.

Reference: Microsoft Access Help Topic: "Format Property -
Date/Time Data Type".

"hh Hour in two[sic] digits (00 to 23)."

To demonstrate the issue:

1. Create a new blank database.

2. Create a new unbound form.

3. Add an unbound Text Box.

4. Set it's Format Property to "mm/dd/yyyy hh:nn".

5. Waste the next hour zorking around trying to get it to display
military time for hours less than 10. (OK, go ahead and bind it to a
Table Date/Time Field. Waste two hours. Fool with the Input Mask
Property. Waste three hours.)

This Format Property issue also applies to Reports, but can be kludged
by crafting a calculated Control with the Control Source set to an
expression calling the Format Function with the same format string
(=Format([MyDateTime], "mm/dd/yyyy hh:nn")), which works as
documented, but this technique is useless for Form data-entry Controls
that need to display military time.

  #2  
Old August 17th, 2006, 12:44 PM posted to microsoft.public.access.forms,microsoft.public.access.reports
[email protected]
external usenet poster
 
Posts: 8
Default Format Property bug: "hh" doesn't display leading zero

wrote:

[Just trying to see how this lame word-wrapping works. And why does it
use my e-mail address as my identifier when most everybody else has
their nickname?]

A number of closed topics deal with problems displaying military time
with various suggested solutions, but none of the discussions I have
seen mention that the the underlying problem seems to be a bug in
Access' Format Property.

I was unable to find a discussion of this problem in the Microsoft
Knowlege Base.

Military time (and many scheduling and dispatching applications) always
displays 24 hours with a leading zero for hours less than 10, e.g.,
"08/17/2006 05:35"

Contrary to its documentation, the Microsoft Access Format Property
does not display a leading zero for times with hours less than 10.

Reference: Microsoft Access Help Topic: "Format Property - Date/Time
Data Type".

"hh Hour in two[sic] digits (00 to 23)."

To demonstrate the issue:

1. Create a new blank database.

2. Create a new unbound form.

3. Add an unbound Text Box.

4. Set it's Format Property to "mm/dd/yyyy hh:nn".

5. Waste the next hour zorking around trying to get it to display
military time for hours less than 10. (OK, go ahead and bind it to a
Table Date/Time Field. Waste two hours. Fool with the Input Mask
Property. Waste three hours.)

This Format Property issue also applies to Reports, but can be kludged
by crafting a calculated Control with the Control Source set to an
expression calling the Format Function with the same format string
(=Format([MyDateTime], "mm/dd/yyyy hh:nn")), which works as documented,
but this technique is useless for Form data-entry Controls that need to
display military time.

  #3  
Old August 17th, 2006, 12:45 PM posted to microsoft.public.access.forms,microsoft.public.access.reports
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Format Property bug: "hh" doesn't display leading zero

wrote:
A number of closed topics deal with problems displaying military time
with various suggested solutions, but none of the discussions I have
seen mention that the the underlying problem seems to be a bug in
Access' Format Property.

I was unable to find a discussion of this problem in the Microsoft
Knowlege Base.

Military time (and many scheduling and dispatching applications)
always displays 24 hours with a leading zero for hours less than 10,
e.g., "08/17/2006 05:35"

Contrary to its documentation, the Microsoft Access Format Property
does not display a leading zero for times with hours less than 10.

Reference: Microsoft Access Help Topic: "Format Property -
Date/Time Data Type".

"hh Hour in two[sic] digits (00 to 23)."

To demonstrate the issue:

1. Create a new blank database.

2. Create a new unbound form.

3. Add an unbound Text Box.

4. Set it's Format Property to "mm/dd/yyyy hh:nn".

5. Waste the next hour zorking around trying to get it to display
military time for hours less than 10. (OK, go ahead and bind it to a
Table Date/Time Field. Waste two hours. Fool with the Input Mask
Property. Waste three hours.)

This Format Property issue also applies to Reports, but can be kludged
by crafting a calculated Control with the Control Source set to an
expression calling the Format Function with the same format string
(=Format([MyDateTime], "mm/dd/yyyy hh:nn")), which works as
documented, but this technique is useless for Form data-entry Controls
that need to display military time.


A workaround would be to place a TextBox on top of your editable one that has
the Format() function in its ControlSource to give you the appearance you want.
In the GotFocus event set focus to the editable TextBox behind the non-editable
one. Since formatting is lost when a control has focus anyway the result should
be identical to a TextBox where the format property worked as desired.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #4  
Old August 17th, 2006, 12:56 PM posted to microsoft.public.access.forms,microsoft.public.access.reports
Brendan Reynolds
external usenet poster
 
Posts: 1,241
Default Format Property bug: "hh" doesn't display leading zero

Seems to work as documented for me. Tested in both Access 2003 and Access
2000. Here's the result ...

http://brenreyn.brinkster.net/format.jpg

--
Brendan Reynolds
Access MVP

wrote in message
oups.com...
A number of closed topics deal with problems displaying military time
with various suggested solutions, but none of the discussions I have
seen mention that the the underlying problem seems to be a bug in
Access' Format Property.

I was unable to find a discussion of this problem in the Microsoft
Knowlege Base.

Military time (and many scheduling and dispatching applications) always
displays 24 hours with a leading zero for hours less than 10, e.g.,
"08/17/2006 05:35"

Contrary to its documentation, the Microsoft Access Format Property
does not display a leading zero for times with hours less than 10.

Reference: Microsoft Access Help Topic: "Format Property -
Date/Time Data Type".

"hh Hour in two[sic] digits (00 to 23)."

To demonstrate the issue:

1. Create a new blank database.

2. Create a new unbound form.

3. Add an unbound Text Box.

4. Set it's Format Property to "mm/dd/yyyy hh:nn".

5. Waste the next hour zorking around trying to get it to display
military time for hours less than 10. (OK, go ahead and bind it to a
Table Date/Time Field. Waste two hours. Fool with the Input Mask
Property. Waste three hours.)

This Format Property issue also applies to Reports, but can be kludged
by crafting a calculated Control with the Control Source set to an
expression calling the Format Function with the same format string
(=Format([MyDateTime], "mm/dd/yyyy hh:nn")), which works as
documented, but this technique is useless for Form data-entry Controls
that need to display military time.



  #5  
Old August 17th, 2006, 01:05 PM posted to microsoft.public.access.forms,microsoft.public.access.reports
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Format Property bug: "hh" doesn't display leading zero

Brendan Reynolds wrote:
Seems to work as documented for me. Tested in both Access 2003 and
Access 2000. Here's the result ...

http://brenreyn.brinkster.net/format.jpg


You made me look Brendan. Apparently if your regional settings in Control Panel
are set up with hh: instead of h: then it works. Without that then (Access 97
at least) definitely ignores the leading zero on the hour even when the format
property calls for it.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #6  
Old August 17th, 2006, 01:23 PM posted to microsoft.public.access.forms,microsoft.public.access.reports
Brendan Reynolds
external usenet poster
 
Posts: 1,241
Default Format Property bug: "hh" doesn't display leading zero


Thanks Rick. I can reproduce that in Access 2000, but not in Access 2003. So
it looks like it may have been fixed in either Access 2002 or Access 2003. I
don't have an installation of Access 2002 available to test.

My tests also involved two different versions of Windows. Access 2000 is
running on Window 98, Access 2003 on Windows XP SP2. So I can not rule out
the possibility that the problem may be related to the OS version.

--
Brendan Reynolds
Access MVP


"Rick Brandt" wrote in message
om...
Brendan Reynolds wrote:
Seems to work as documented for me. Tested in both Access 2003 and
Access 2000. Here's the result ...

http://brenreyn.brinkster.net/format.jpg


You made me look Brendan. Apparently if your regional settings in Control
Panel are set up with hh: instead of h: then it works. Without that then
(Access 97 at least) definitely ignores the leading zero on the hour even
when the format property calls for it.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com



  #7  
Old August 17th, 2006, 01:25 PM posted to microsoft.public.access.forms,microsoft.public.access.reports
BruceM
external usenet poster
 
Posts: 356
Default Format Property bug: "hh" doesn't display leading zero

I noticed that with h: in the regional settings the format is ignored, but
you can apply the format h:nn even if hh: is the default. It works one way,
but not the other. An, um, oversight, I guess.

"Rick Brandt" wrote in message
om...
Brendan Reynolds wrote:
Seems to work as documented for me. Tested in both Access 2003 and
Access 2000. Here's the result ...

http://brenreyn.brinkster.net/format.jpg


You made me look Brendan. Apparently if your regional settings in Control
Panel are set up with hh: instead of h: then it works. Without that then
(Access 97 at least) definitely ignores the leading zero on the hour even
when the format property calls for it.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com



  #8  
Old August 17th, 2006, 01:29 PM posted to microsoft.public.access.forms,microsoft.public.access.reports
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Format Property bug: "hh" doesn't display leading zero

Brendan Reynolds wrote:
Thanks Rick. I can reproduce that in Access 2000, but not in Access
2003. So it looks like it may have been fixed in either Access 2002
or Access 2003. I don't have an installation of Access 2002 available
to test.
My tests also involved two different versions of Windows. Access 2000
is running on Window 98, Access 2003 on Windows XP SP2. So I can not
rule out the possibility that the problem may be related to the OS
version.


Good point. I only have A97 here at home, but I am running WinXP SP2 so (for
A97 at least) the newer OS doesn't fix the problem.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


  #9  
Old August 17th, 2006, 01:38 PM posted to microsoft.public.access.forms,microsoft.public.access.reports
Brendan Reynolds
external usenet poster
 
Posts: 1,241
Default Format Property bug: "hh" doesn't display leading zero

Thanks again, Rick. Probably not an OS issue then.

It would be interesting to hear if anyone can reproduce the problem using
Access 2002 or Access 2003.

--
Brendan Reynolds
Access MVP

"Rick Brandt" wrote in message
om...
Brendan Reynolds wrote:
Thanks Rick. I can reproduce that in Access 2000, but not in Access
2003. So it looks like it may have been fixed in either Access 2002
or Access 2003. I don't have an installation of Access 2002 available
to test.
My tests also involved two different versions of Windows. Access 2000
is running on Window 98, Access 2003 on Windows XP SP2. So I can not
rule out the possibility that the problem may be related to the OS
version.


Good point. I only have A97 here at home, but I am running WinXP SP2 so
(for A97 at least) the newer OS doesn't fix the problem.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com



  #10  
Old August 17th, 2006, 01:45 PM posted to microsoft.public.access.forms,microsoft.public.access.reports
[email protected]
external usenet poster
 
Posts: 8
Default Format Property bug: "hh" doesn't display leading zero

Bruce, Rick, Brandon:

I changed my Regional Settings to "hh:" and voila, and it was
displaying "08/17/2006 01:45" when I switched back to the Access
window.

I had the problem running Access 2000 on Windows 2000.

Now I'm going to have to figure out the implications of changing the
default. I'm under the impression that the whole point of the Format
Property is to override the default.

Thanks for your solution to the mystery!

[Any idea why my identifier is my e-mail address?]

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:11 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.