Results 1 to 4 of 4
  1. #1
    mismag is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Feb 2019
    Location
    California, US
    Posts
    58

    Data type of a text field changing because of group by in query

    Hi,



    I created a query as follows.
    SELECT TblDealers.DealershipName, TblSales.SaleDate, TblSales.FullName, TblSaleDetails.ProductName, Sum(TblSaleDetails.Deals) AS Deals, Sum(TblSales.TotalDeals) AS TotalDeals, Sum(TblSaleDetails.GrossAmount) AS GrossAmount
    FROM (TblDealers INNER JOIN TblSales ON TblDealers.[DealershipID] = TblSales.[DealershipID]) INNER JOIN TblSaleDetails ON TblSales.[SaleID] = TblSaleDetails.[SaleID]
    GROUP BY TblDealers.DealershipName, TblSales.SaleDate, TblSales.FullName, TblSaleDetails.ProductName
    HAVING (((TblSales.SaleDate)=#1/1/2019# Or (TblSales.SaleDate)=#2/1/2019#))
    ORDER BY TblSales.SaleDate;
    If you see in the query the field ProductName from the SaleDetails table actually is a text field.

    When I am connecting to this query from Tableau (Reporting tool), the ProductName field is automatically changing its data type to Number and is displaying the productID instead of ProductName.

    Any idea how to solve this?

    TIA....

    Regards,
    ASD

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If I had to guess, the data type is actually numeric but it's a lookup field, where you see the text value but the numeric value is actually what gets saved.

    http://www.theaccessweb.com/lookupfields.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    mismag is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Feb 2019
    Location
    California, US
    Posts
    58
    Is there a way to fix this?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't/won't use lookup fields. You can probably join to the product table and get the description from there.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 07-23-2018, 02:12 PM
  2. Replies: 8
    Last Post: 12-14-2015, 07:02 AM
  3. Changing Data Type of Imported Field Name
    By rhubarb in forum Import/Export Data
    Replies: 12
    Last Post: 06-16-2014, 08:20 AM
  4. Replies: 1
    Last Post: 04-24-2013, 11:50 AM
  5. Replies: 1
    Last Post: 05-17-2010, 12:21 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