Table is formatted as Short Time. However when I run a query it produces the time as hh:mm:ss. I want to display as short time (It is used for scheduling).
Table is formatted as Short Time. However when I run a query it produces the time as hh:mm:ss. I want to display as short time (It is used for scheduling).
In the query design, right click on the field and set the format you wish.
The answer is fine, but I thought you might appreciate some elaboration for future use.
The table field contains the "actual" value (in this case, datetime, as an 8 byte double precision floating point number). The table field can be formatted so as to change what is displayed, but that does not change the underlying value. If you query a table field and don't apply a format that is commensurate with what you expect/want to see you will get the ACTUAL value, not the formatted view of the value - unless the actual value isn't affected by some format that you might otherwise apply.
Last edited by Micron; 08-08-2018 at 05:51 PM. Reason: clarification
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
Thanks all. Your direction fixed the field query. However, I don't mean to beat this incrementally, but, when I try to combine the start and end times I lose the short time formatting.
Sunday: [Sun Start] & "-" & [Sun End] >returns this> 5:00:00 AM-11:00:00 AM
The same formatting in the property sheet did not produce the same results
you are creating a text field so you will need to use the format function on each part
format([Sun Start],"short time") & "-" & format([Sun End]],"short time")
the format function converts a date value (i.e. a decimal) to a text value
the format property displays a date value (i.e. a decimal) but retains the underlying decimal value. This matters because you can do calculations, comparisons and sorting with the underlying value which would not work with a text value - for example a text value of '1st Jan' comes after a text value of '1st Feb' when sorting.
Thank you much! (Far be it for me to correct...you fat fingered an extra "]" after "[Sun End]". I really appreciate the help.
Format([Sun Start],"Short Time") & "-" & Format([Sun End],"Short Time")
you are creating a text field so you will need to use the format function on each part
format([Sun Start],"short time") & "-" & format([Sun End]],"short time")
the format function converts a date value (i.e. a decimal) to a text value
the format property displays a date value (i.e. a decimal) but retains the underlying decimal value. This matters because you can do calculations, comparisons and sorting with the underlying value which would not work with a text value - for example a text value of '1st Jan' comes after a text value of '1st Feb' when sorting.