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];