query and Report display long time instead of short time

W

wigla

Why does my Query (and therefore my Report) still display the long time when
I have set all the underlying tables and the field itself to short time? I am
using a choose function in the Query field. Does that affect the format?
 
J

John Spencer MVP

Because the format controls the display of the data for the particular object
that is open, it does not control the display of the data for other objects.
What is stored in the field is the entire time in the form of a number where
the decimal portion represents the time (as a part of a day) and the integer
portion represents the date as a number offset from December 30, 1899

If you want short time, you will need to set the format of the control in the
report that way or use the Format function in your query to return a string
that shows the time in the desired format.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
W

wigla

I have begun with a 2 tables, where all time fields are set to short time.
Then I use a choose function in a query to combine the times from the 2
tables. In this query the time is now displayed with seconds (long time,
correct?). I don't know why? formatting the field has no affect.

I use 2 or 3 other queries to collect information before I am ready for my
report, but they all show the time with the seconds. I have formatted the
report control to short time, but it still displays the seconds. I went back
and formatted all the query fields to short time with no affect. How do I get
my report to show only hours and minutes?
 
J

John Spencer MVP

Unless you set the format property of the new field in the query to Short
Time, it will display the full time.

When you attempt to use the results of the query in a form or report, the
field data is passed to the control on the form (not the formatted display
text). On the report or form, you will have to use the format property of the
control and set it to Short Time.

If for some reason you are not seeing this then there is some problem that
exists with your application.

Try use the Format Function in the query to force a conversion to a string'

Field: MyshortTime: Format([MyTimeField],"Short Time")

Also check your computer OS settings under Regional and Language options and
see if that is affecting the Short Time format.

Instead of using the built-in Short Time function use
Format([MyTimeField,"hh:nn")



John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

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