Results 1 to 6 of 6
  1. #1
    seanfleming10 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    2

    Access Changing Query Field Name to Expr1035

    Hello,

    I've got an Access Database setup with multiple tables. In my master query, I've specified the criteria I'd like to see. When I run the query in Access, everything returns fine. However, when I connect to the database from excel, my query field - "GPS Dept #" is renamed to Expr1035. How do I prevent this from happending. My SQL is shown below.

    Thanks,
    Sean






    SELECT [COE Hierarchy].[Cost Center #], [COE Hierarchy].[Cost Center Name], [COE Hierarchy].[Profit Center], [COE Hierarchy].[Profit Center Name], [COE Hierarchy].[L2 Description], [COE Hierarchy].[L2 Leader], [COE Hierarchy].[L3 Description], [COE Data].[PY Budget], [COE Hierarchy].[L3 Leader], [COE Hierarchy].[L4 Description], [COE Hierarchy].[L4 Leader], [COE Hierarchy].System, [COE Hierarchy].Country, [COE Hierarchy].Company, [COE Data].Period, [COE Hierarchy].COE, [COE Data].[Cost Element #], [Category Rollup].[Cost Element Name], [Category Rollup].[Category Group], [Category Rollup].[RE Category], [Category Rollup].[RE Sort Order], [COE Data].Actuals, [Category Rollup].[Slide Category], [Category Rollup].[Slide Category Sort Order], [COE Hierarchy].[Finance Partner], Quarter.Quarter, [COE Data].[Planning Version], [COE Data].Budget, [COE Data].[PY Actuals], OCM.[OCM Category], OCM.[OCM Sub Category], [COE Hierarchy].[New Org], [COE Hierarchy].[L5 Description], [COE Data].[RE Prior], [COE Data].[RE Current], [COE Hierarchy].[GPS Dept #],[COE Hierarchy].[FDW - L1], [COE Hierarchy].[FDW - L2], [COE Hierarchy].[FDW - L3], [COE Hierarchy].[FDW - L4], [COE Hierarchy].[FDW - L5], [COE Hierarchy].[FDW - L6], [COE Hierarchy].[FDW - L7], [Category Rollup].[RE Agg RLI], [Category Rollup].[RLI Level 5], [Category Rollup].[RLI Level 6], [Category Rollup].[RLI Level 7], [COE Hierarchy].[GPS Dept #]FROM (OCM RIGHT JOIN ([COE Hierarchy] RIGHT JOIN ([Category Rollup] RIGHT JOIN [COE Data] ON [Category Rollup].[Cost Element] = [COE Data].[Cost Element #]) ON [COE Hierarchy].[Unique ID] = [COE Data].[Unique ID]) ON OCM.Account = [COE Data].[Cost Element #]) LEFT JOIN Quarter ON [COE Data].Period = Quarter.Period;

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    Not sure but perhaps this is because you have used "#​" in a field name.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    I think because you have the field in the SELECT clause twice, Access will alias the second instance of it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Why are you returning the same field twice in your Select clause ([COE Hierarchy].[GPS Dept #])?
    When you do that without using an alias, I believe it gives the second one a generic name like that.

    Then way to get around that is to give each its own distinct alias, i.e.

    SELECT ...,[COE Hierarchy].[GPS Dept #] as GPS_Dept1,..., [COE Hierarchy].[GPS Dept #] as GPS_Dept2 FROM ...

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    And it would help if you got rid of the spaces and special characters (examples: [Cost Element #] and [FDW - L5]) in your object names.....

  6. #6
    seanfleming10 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    2
    That was it. I built the query in design view and didn't realize the duplication. Thanks for the SQL around Alias - very helpful.

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

Similar Threads

  1. Replies: 5
    Last Post: 08-27-2014, 01:46 PM
  2. Replies: 1
    Last Post: 07-28-2014, 06:10 PM
  3. Changing field value in report view in access
    By tanyapeila in forum Queries
    Replies: 2
    Last Post: 03-17-2014, 01:31 PM
  4. Changing Field definition within a query
    By gm_lowery in forum Queries
    Replies: 5
    Last Post: 08-30-2012, 09:19 AM
  5. changing SQL servers hurts Access query
    By Rockitman31 in forum Access
    Replies: 2
    Last Post: 10-14-2011, 08:34 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