Results 1 to 6 of 6
  1. #1
    bclerkin1 is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    3

    Formatted "short Time" in the table, and entered as short time, is converted to hh:mm:ss in query


    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).

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 10 Access 2016
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    In the query design, right click on the field and set the format you wish.

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,363
    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.

  4. #4
    bclerkin1 is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    3
    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

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,840
    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.

  6. #6
    bclerkin1 is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    3

    Thank you

    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")




    Quote Originally Posted by Ajax View Post
    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.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 04-07-2017, 02:08 AM
  2. Replies: 5
    Last Post: 01-13-2017, 02:20 AM
  3. Short time format problems
    By JeroenMioch in forum Forms
    Replies: 7
    Last Post: 12-09-2015, 01:17 PM
  4. Problem adding short time
    By Retszat in forum Reports
    Replies: 2
    Last Post: 07-15-2012, 10:50 PM
  5. Dealing with Short Time format
    By hawkins in forum Access
    Replies: 0
    Last Post: 08-16-2011, 11:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums