Hi All,
I have been pulling my hair out for the past 6 hours on-and-off trying to identify where I have gone wrong with my SQL Output that is causing Run-time error '3142' to appear saying Characters found after end of SQL statement.
Is anyone able to quickly identify where the rogue character is that is throwing everything out of sync?
The original SQL Output in VBA is:
When this is printed it gives me the following:
Let me know if anything else needs sharing.
I have been pulling my hair out for the past 6 hours on-and-off trying to identify where I have gone wrong with my SQL Output that is causing Run-time error '3142' to appear saying Characters found after end of SQL statement.
Is anyone able to quickly identify where the rogue character is that is throwing everything out of sync?
The original SQL Output in VBA is:
Code:
SQL_Output = "SELECT TblTcAOG.ID, TblTcAOG.Date, TblTcAOG.STN, TblTcAOG.REG, TblTcAOG.ATA, TblTcAOG.[ATA2Digit Description], TblTcAOG.ATA4DIGIT, TblTcAOG.ATA2DIGIT, TblTcAOG.ATALAST2, TblTcAOG.[REASON FOR AOG], TblTcAOG.[AOG HRS], TblTcAOG.[AOG MINS], TblTcAOG.AOGTime, TblTcAOG.AOGTotalMins, TblTcAOG.[Event Type], TblTcAOG.[Severity Index], TblTcAOG.[Dispatched IAW MEL], TblTcAOG.[MEL Reference], TblTcAOG.[ETOPS Sector], TblTcAOG.[Charter Flight], tblactype.actypeid, tblactype.Manufacturer, tblactype.Type " & _
"FROM (tblactype INNER JOIN TblAcrft ON tblactype.[actypeid] = TblAcrft.[ModelLink]) INNER JOIN TblTcAOG ON TblAcrft.[Reg] = TblTcAOG.[REG]; " & _
"WHERE ((TblTcAOG.Date)>=" & dStart & " And (TblTcAOG.Date)<=" & dEnd & " AND ((TblTcAOG.AOGTotalMins)>=[forms]![FrmRptCriteriaAOG]![AOG_Time])) "
When this is printed it gives me the following:
Code:
SELECT TblTcAOG.ID, TblTcAOG.Date, TblTcAOG.STN, TblTcAOG.REG, TblTcAOG.ATA, TblTcAOG.[ATA2Digit Description], TblTcAOG.ATA4DIGIT, TblTcAOG.ATA2DIGIT, TblTcAOG.ATALAST2, TblTcAOG.[REASON FOR AOG], TblTcAOG.[AOG HRS], TblTcAOG.[AOG MINS], TblTcAOG.AOGTime, TblTcAOG.AOGTotalMins, TblTcAOG.[Event Type], TblTcAOG.[Severity Index], TblTcAOG.[Dispatched IAW MEL], TblTcAOG.[MEL Reference], TblTcAOG.[ETOPS Sector], TblTcAOG.[Charter Flight], tblactype.actypeid, tblactype.Manufacturer, tblactype.Type FROM (tblactype INNER JOIN TblAcrft ON tblactype.[actypeid] = TblAcrft.[ModelLink]) INNER JOIN TblTcAOG ON TblAcrft.[Reg] = TblTcAOG.[REG]; WHERE ((TblTcAOG.Date)>=#04/11/2015# And (TblTcAOG.Date)<=#04/11/2019# AND ((TblTcAOG.AOGTotalMins)>=[forms]![FrmRptCriteriaAOG]![AOG_Time])) AND TblTcAOG.[ATA2DIGIT] IN (0,20,21,12,11,10,09,08,07,06,05,24,25,26,27,28,29,30,31,32,33,22,23,34,35,36,38,47,46,49,51,52,53,54,55,56,57,70,71,72,73,74,75,76,77,78,79,80,01,02,03,04)
Let me know if anything else needs sharing.