Results 1 to 4 of 4
  1. #1
    smg is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    121

    sql syntax to format all numeric fields in union query

    I have a union query where I select * (all) from both queries utilized. In those two queries many of those fields are formatted as standard, two decimal places. When I run the union query those fields lose their formatting. Is there sql code I can use to format all the number fields without having to select and format each individually? The fields that are dates and text all output correctly.

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Formatting isn't data, the query will only return the data, and if that means 10.00 is returned as 10 , then it's correct.
    Generally speaking you shouldn't format results in a query, you should do it in the Form or Report control properties, then it doesn't matter what happens until your user needs to see it.

    The only exception would be to maybe concatenate special characters or perhaps add FirstName & " " & LastName together or to output a number or data as a string.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    The solution is to store the data as you want to see it? Store 10.00 not format 10 as 10.00.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    smg is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    121
    argh. Not what I wanted to hear but what I needed to hear. Thanks.

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

Similar Threads

  1. Replies: 7
    Last Post: 05-18-2019, 06:20 AM
  2. Replies: 3
    Last Post: 11-29-2018, 03:18 PM
  3. Replies: 8
    Last Post: 09-12-2015, 11:28 AM
  4. Failing to grasp the syntax of a Union Query
    By brharrii in forum Queries
    Replies: 6
    Last Post: 05-09-2013, 11:51 AM
  5. Format two fields in a Union Query as Currency
    By alansidman in forum Queries
    Replies: 1
    Last Post: 12-14-2012, 12:41 PM

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