Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Time function

Geek News

Time function
Susanne 12/30/2008 9:07:26 PM
I need to display in formation in military time. hh:nn, ie, short time. I do
not want the text box to change to "normal" view when the field is entered ,
with AM / PM showing. No matter what I do, it still displays with 03:46:01
PM when the field is entered. Help?
Re: Time function
Marshall Barton <marshbarton[ at ]wowway.com> 12/30/2008 9:48:02 PM
Susanne wrote:

[Quoted Text]
>I need to display in formation in military time. hh:nn, ie, short time. I do
>not want the text box to change to "normal" view when the field is entered ,
>with AM / PM showing. No matter what I do, it still displays with 03:46:01
>PM when the field is entered. Help?


If the field's data type is Date/Time, just set the text
box's Format property to
hh:nn:ss

--
Marsh
MVP [MS Access]
Re: Time function
Susanne 12/30/2008 10:04:30 PM
That's what I originally did, and it worked, but we only want to see the hour
and minute. I may need to just set it at that. The problem arises if the
data is manually entered, therefore overr-riding the preset time.

Thanks!

"Marshall Barton" wrote:

[Quoted Text]
> Susanne wrote:
>
> >I need to display in formation in military time. hh:nn, ie, short time. I do
> >not want the text box to change to "normal" view when the field is entered ,
> >with AM / PM showing. No matter what I do, it still displays with 03:46:01
> >PM when the field is entered. Help?
>
>
> If the field's data type is Date/Time, just set the text
> box's Format property to
> hh:nn:ss
>
> --
> Marsh
> MVP [MS Access]
>
Re: Time function
Marshall Barton <marshbarton[ at ]wowway.com> 12/30/2008 10:40:08 PM
If you don't want to see the seconds, set the Format
property to:
hh:nn

I don't understand the problem with users entering a time.
AFAIK, that should not be an issue.
--
Marsh
MVP [MS Access]


Susanne wrote:
[Quoted Text]
>That's what I originally did, and it worked, but we only want to see the hour
>and minute. I may need to just set it at that. The problem arises if the
>data is manually entered, therefore overr-riding the preset time.
>
>
>"Marshall Barton" wrote:
>
>> Susanne wrote:
>>
>> >I need to display in formation in military time. hh:nn, ie, short time. I do
>> >not want the text box to change to "normal" view when the field is entered ,
>> >with AM / PM showing. No matter what I do, it still displays with 03:46:01
>> >PM when the field is entered. Help?
>>
>>
>> If the field's data type is Date/Time, just set the text
>> box's Format property to
>> hh:nn:ss
Re: Time function
"tkelley via AccessMonster.com" <u47368[ at ]uwe> 12/30/2008 10:42:26 PM
Can you use the after update event of the field to set it to whatever format
you want?



Susanne wrote:
[Quoted Text]
>That's what I originally did, and it worked, but we only want to see the hour
>and minute. I may need to just set it at that. The problem arises if the
>data is manually entered, therefore overr-riding the preset time.
>
>Thanks!
>
>> >I need to display in formation in military time. hh:nn, ie, short time. I do
>> >not want the text box to change to "normal" view when the field is entered ,
>[quoted text clipped - 4 lines]
>> box's Format property to
>> hh:nn:ss

--
Message posted via http://www.accessmonster.com

Re: Time function
John W. Vinson <jvinson[ at ]STOP_SPAM.WysardOfInfo.com> 12/31/2008 1:40:21 AM
On Tue, 30 Dec 2008 14:04:30 -0800, Susanne
<Susanne[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
>That's what I originally did, and it worked, but we only want to see the hour
>and minute. I may need to just set it at that. The problem arises if the
>data is manually entered, therefore overr-riding the preset time.

You can use a Format of hh:nn to display existing data, and an Input Mask of
00:00 to force entry of just the four digits.
--

John W. Vinson [MVP]
Re: Time function
Susanne 12/31/2008 1:45:00 AM
I got it to work, before your comment ... it is not easy overriding presets
in Access. I would do that, that is, set it to hh:nn, then it would
automatically change the properties to the field to short date (the hh:nn
disappeared) and also the input mask. Appearance wise it would display fine,
but enter the field and it botches what I wanted.

The only way I got everything to work correctly was in VBA to set the field
= Format(Time, "hh:nn"). Access then didn't mess around with the layout and
change it when you enter the field into the date format with AM or PM.

"Marshall Barton" wrote:

[Quoted Text]
> If you don't want to see the seconds, set the Format
> property to:
> hh:nn
>
> I don't understand the problem with users entering a time.
> AFAIK, that should not be an issue.
> --
> Marsh
> MVP [MS Access]
>
>
> Susanne wrote:
> >That's what I originally did, and it worked, but we only want to see the hour
> >and minute. I may need to just set it at that. The problem arises if the
> >data is manually entered, therefore overr-riding the preset time.
> >
> >
> >"Marshall Barton" wrote:
> >
> >> Susanne wrote:
> >>
> >> >I need to display in formation in military time. hh:nn, ie, short time. I do
> >> >not want the text box to change to "normal" view when the field is entered ,
> >> >with AM / PM showing. No matter what I do, it still displays with 03:46:01
> >> >PM when the field is entered. Help?
> >>
> >>
> >> If the field's data type is Date/Time, just set the text
> >> box's Format property to
> >> hh:nn:ss
>
Re: Time function
Marshall Barton <marshbarton[ at ]wowway.com> 12/31/2008 5:29:52 AM
I still don't understand what you mean by "presets". Maybe
you mean the default property settings? If so, you can just
replace whatever Access put in with whatever you want.
OTOH, using an input mask can override all kinds of things
(one reason why I never use input masks). First thing I
would do is remove the input mask and see where you stand,
before beating your head against the wall trying to overcome
the idiosyncracies of input masks.

Where/what did you set the Format property? It should be
the form text box, not a query or table field.

What you did using the Format function may(?) not be a good
fix because Format always returns a string value, not a time
value.
--
Marsh
MVP [MS Access]


Susanne wrote:
[Quoted Text]
>I got it to work, before your comment ... it is not easy overriding presets
>in Access. I would do that, that is, set it to hh:nn, then it would
>automatically change the properties to the field to short date (the hh:nn
>disappeared) and also the input mask. Appearance wise it would display fine,
>but enter the field and it botches what I wanted.
>
>The only way I got everything to work correctly was in VBA to set the field
>= Format(Time, "hh:nn"). Access then didn't mess around with the layout and
>change it when you enter the field into the date format with AM or PM.
>
>"Marshall Barton" wrote:
>
>> If you don't want to see the seconds, set the Format
>> property to:
>> hh:nn
>>
>> I don't understand the problem with users entering a time.
>> AFAIK, that should not be an issue.
>>
>>
>> Susanne wrote:
>> >That's what I originally did, and it worked, but we only want to see the hour
>> >and minute. I may need to just set it at that. The problem arises if the
>> >data is manually entered, therefore overr-riding the preset time.
>> >
>> >
>> >"Marshall Barton" wrote:
>> >
>> >> Susanne wrote:
>> >>
>> >> >I need to display in formation in military time. hh:nn, ie, short time. I do
>> >> >not want the text box to change to "normal" view when the field is entered ,
>> >> >with AM / PM showing. No matter what I do, it still displays with 03:46:01
>> >> >PM when the field is entered. Help?
>> >>
>> >>
>> >> If the field's data type is Date/Time, just set the text
>> >> box's Format property to
>> >> hh:nn:ss
>>

Re: Time function
Susanne 12/31/2008 1:16:01 PM
I was wondering about that (the string value). I mainly just need the values
to get a total time (houre:minute) in a calculation. What I mean by presets
is the default settings for lack of a better word at the time I was typing
(looking at something that you know is taking too long and getting frustrated
because it should be simple). I got even more frustrated having to change
the 9+ fields everytime I made changes.

Oh, and yes, I was setting it up in the form. A button would be pressed to
enter the current "time" then when the second button was pressed to enter the
end time, it would also calculate the total time for the 3rd field.

I thank everyone for your suggestions and I will see if I can make it work
the more simple way without having the field value change on me when the
field is entered.

"Marshall Barton" wrote:

[Quoted Text]
> I still don't understand what you mean by "presets". Maybe
> you mean the default property settings? If so, you can just
> replace whatever Access put in with whatever you want.
> OTOH, using an input mask can override all kinds of things
> (one reason why I never use input masks). First thing I
> would do is remove the input mask and see where you stand,
> before beating your head against the wall trying to overcome
> the idiosyncracies of input masks.
>
> Where/what did you set the Format property? It should be
> the form text box, not a query or table field.
>
> What you did using the Format function may(?) not be a good
> fix because Format always returns a string value, not a time
> value.
> --
> Marsh
> MVP [MS Access]
>
>
> Susanne wrote:
> >I got it to work, before your comment ... it is not easy overriding presets
> >in Access. I would do that, that is, set it to hh:nn, then it would
> >automatically change the properties to the field to short date (the hh:nn
> >disappeared) and also the input mask. Appearance wise it would display fine,
> >but enter the field and it botches what I wanted.
> >
> >The only way I got everything to work correctly was in VBA to set the field
> >= Format(Time, "hh:nn"). Access then didn't mess around with the layout and
> >change it when you enter the field into the date format with AM or PM.
> >
> >"Marshall Barton" wrote:
> >
> >> If you don't want to see the seconds, set the Format
> >> property to:
> >> hh:nn
> >>
> >> I don't understand the problem with users entering a time.
> >> AFAIK, that should not be an issue.
> >>
> >>
> >> Susanne wrote:
> >> >That's what I originally did, and it worked, but we only want to see the hour
> >> >and minute. I may need to just set it at that. The problem arises if the
> >> >data is manually entered, therefore overr-riding the preset time.
> >> >
> >> >
> >> >"Marshall Barton" wrote:
> >> >
> >> >> Susanne wrote:
> >> >>
> >> >> >I need to display in formation in military time. hh:nn, ie, short time. I do
> >> >> >not want the text box to change to "normal" view when the field is entered ,
> >> >> >with AM / PM showing. No matter what I do, it still displays with 03:46:01
> >> >> >PM when the field is entered. Help?
> >> >>
> >> >>
> >> >> If the field's data type is Date/Time, just set the text
> >> >> box's Format property to
> >> >> hh:nn:ss
> >>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net