Greetings!
Recently I started using VBA to programm Microsoft Query, with help of Macro Recorder (wich seems to make somewhat of a mess).
Relative to the code below I get Syntax Error and can't understand why:
.CommandText = Array( _
"SELECT Groups.`Group Name`, `Flown Revenue 2005`.`Agent Code`, Sum(`Flown Revenue 2005`.Coupons) as [Cpns]" & Chr(13) & "" & Chr(10) & "FROM {oj `C:\My Documents\Temporário\Unify\db2006 November-onward Compact`.`Flown Revenue 20" _
, _
"05` `Flown Revenue 2005` LEFT OUTER JOIN `C:\My Documents\Temporário\Unify\db2006 November-onward Compact`.Groups Groups ON `Flown Revenue 2005`.`Agent Code` = Groups.`Agent Code`}" & Chr(13) & "" & Chr(10) & "WHERE Groups.`Group Name`" & " = " & cmdComboBox.Text &" Chr(13) & "" & Chr(10) & "GROUP BY Groups.`G" _
, "roup Name`, `Flown Revenue 2005`.`Agent Code`")
Please advise
Thanks!
Recently I started using VBA to programm Microsoft Query, with help of Macro Recorder (wich seems to make somewhat of a mess).
Relative to the code below I get Syntax Error and can't understand why:
.CommandText = Array( _
"SELECT Groups.`Group Name`, `Flown Revenue 2005`.`Agent Code`, Sum(`Flown Revenue 2005`.Coupons) as [Cpns]" & Chr(13) & "" & Chr(10) & "FROM {oj `C:\My Documents\Temporário\Unify\db2006 November-onward Compact`.`Flown Revenue 20" _
, _
"05` `Flown Revenue 2005` LEFT OUTER JOIN `C:\My Documents\Temporário\Unify\db2006 November-onward Compact`.Groups Groups ON `Flown Revenue 2005`.`Agent Code` = Groups.`Agent Code`}" & Chr(13) & "" & Chr(10) & "WHERE Groups.`Group Name`" & " = " & cmdComboBox.Text &" Chr(13) & "" & Chr(10) & "GROUP BY Groups.`G" _
, "roup Name`, `Flown Revenue 2005`.`Agent Code`")
Please advise
Thanks!