Syntax Error

P

PedroDC

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top