Results 1 to 2 of 2
  1. #1
    TrevorAccess is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2020
    Posts
    1

    Invalid Bracketing Error When Trying to Export Query to Excel

    Greetings,



    Apologies if there is a better place to post this question. I am new to the forum.

    I am also relatively new to Access and very new to SQL. In my new role I am working in several databases that have already been established and used for years for Quality Review of data entered into a mainframe. I am exporting multiple queries to excel so they can be reviewed. This query (which was not setup by me) runs fine in Access, however, when I try to export (to excel) this specific query I receive the following error: Invalid bracketing of name '[Earnings Table Comparison - Changes made to Amount].[Earnings Table Comparison - Changes made to Existing Line.Agt Nu]'.

    I am just not comfortable enough yet with SQL to figure out exactly what needs to be changed and I am surprised (maybe I shouldn't be?) that the query runs correctly in Access but won't export. Any suggestions or thoughts? I have pasted the SQL screen from the query below.

    Thank you!


    SQL

    SELECT [Earnings Table - Today].[Corporate ID], [Earnings Table - Today].[Company ID], [Earnings Table - Today].[Geographic ID], [Earnings Table - Today].[Subcompany ID], [Earnings Table - Today].[Division ID], [Earnings Table - Today].[Department ID], [Earnings Table - Today].[Section ID], [Earnings Table - Today].[System ID], [Earnings Table - Today].[Segment ID], [Earnings Table - Today].Filler, [Earnings Table - Today].Territory, [Earnings Table - Today].Region, [Earnings Table - Today].Branch, [Earnings Table - Today].[Agt Num], [Earnings Table - Today].[Process Seq], [Earnings Table - Today].[Co M US Type], [Earnings Table - Today].[SE N], [Earnings Table - Today].[PC Fixed Ind], [Earnings Table - Today].[Fr FL All Ind], [Earnings Table - Today].[% of Fixed Amount], IIf([Earnings Table - Today]![% of Fixed Amount]=[Earnings Table - Yesterday]![% of Fixed Amount],"No","Yes") AS [Amount Change?], [Earnings Table - Today].[From Date] AS [Today's From Date], [Earnings Table - Today].[To Date] AS [Today's To Date], [Earnings Table Comparison - Lines Added Updated].[Agt Num], [Earnings Table Comparison - Changes made to Existing Line].[Agt Num]
    FROM (([Earnings Table - Today] LEFT JOIN [Earnings Table - Yesterday] ON ([Earnings Table - Today].[To Date] = [Earnings Table - Yesterday].[To Date]) AND ([Earnings Table - Today].[From Date] = [Earnings Table - Yesterday].[From Date]) AND ([Earnings Table - Today].[Co M US Type] = [Earnings Table - Yesterday].[Co M US Type]) AND ([Earnings Table - Today].[Agt Num] = [Earnings Table - Yesterday].[Agt Num])) LEFT JOIN [Earnings Table Comparison - Lines Added Updated] ON [Earnings Table - Today].[Agt Num] = [Earnings Table Comparison - Lines Added Updated].[Agt Num]) LEFT JOIN [Earnings Table Comparison - Changes made to Existing Line] ON [Earnings Table - Today].[Agt Num] = [Earnings Table Comparison - Changes made to Existing Line].[Agt Num]
    WHERE ((([Earnings Table - Today].[Agt Num])<=91000 And ([Earnings Table - Today].[Agt Num])<>9780) AND ((IIf([Earnings Table - Today]![% of Fixed Amount]=[Earnings Table - Yesterday]![% of Fixed Amount],"No","Yes"))<>"No") AND (([Earnings Table Comparison - Lines Added Updated].[Agt Num]) Is Null) AND (([Earnings Table Comparison - Changes made to Existing Line].[Agt Num]) Is Null))
    ORDER BY [Earnings Table - Today].[Agt Num], [Earnings Table - Today].[From Date];

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    having spaces and non alpha numeric characters in table and field names can cause issues

    my guess would be the . in your field

    [Earnings Table Comparison - Changes made to Amount].[Earnings Table Comparison - Changes made to Existing Line.Agt Nu]

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

Similar Threads

  1. Dsum invalid bracketing error
    By MaryRod in forum Queries
    Replies: 11
    Last Post: 03-27-2014, 06:26 PM
  2. Replies: 16
    Last Post: 08-23-2013, 01:11 PM
  3. VBA Error: Invalid Bracketing of Name
    By kawi6rr in forum Programming
    Replies: 3
    Last Post: 02-21-2013, 05:26 PM
  4. Replies: 13
    Last Post: 12-12-2012, 08:17 PM
  5. Replies: 3
    Last Post: 04-12-2011, 10:22 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