Thread: Syntax Error
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
PedroDC PedroDC is offline
external usenet poster
 
Posts: 4
Default Syntax Error

Greetings!

I have a form where a user can select a field (Group Name) and after
pressing OK it should show some records.

The code I have doesn't run because I get "Compile Error: Syntax Error". The
SQL string in the VBA Macro is (got it with Macro Recorder):


..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`")


I can't see where is the Syntax Error.

Please help
Thanks!