Hi all,
Have the following code to retrieve data from an Access db;
GetRejectTemp2SQL(RejectTemp2SQL);
with ADOQuery3 do begin
Close;
SQL.Add(RejectTemp2SQL);
Active:= True;
First;
end;
where 'RejectTemp2SQL' is a string and 'GetRejectTemp2SQL'
is the following procedure;
procedure GetRejectTemp2SQL(var RejectTemp2SQL: string);
begin
RejectTemp2SQL:= 'select Year, Month, ProcName, UserID, ' +
'COUNT(ProcName)AS PROC_COUNT from RejectTemp ' +
'group by Year, Month, ProcName, UserID ' +
'order by Year, Month, ProcName, UserID';
end;
When this AdoQuery3 code executes I get the following error message;
'Project raised exception class EoleException with message ‘Syntax error in ‘ProcName selected Year’’. Process stopped. Use step or Run to continue.'
The SQL is fine - I've run it in Access and no problems, so what the heck is wrong?
Gratefull for any help as am getting to the 'punch the wall' stage...
Have the following code to retrieve data from an Access db;
GetRejectTemp2SQL(RejectTemp2SQL);
with ADOQuery3 do begin
Close;
SQL.Add(RejectTemp2SQL);
Active:= True;
First;
end;
where 'RejectTemp2SQL' is a string and 'GetRejectTemp2SQL'
is the following procedure;
procedure GetRejectTemp2SQL(var RejectTemp2SQL: string);
begin
RejectTemp2SQL:= 'select Year, Month, ProcName, UserID, ' +
'COUNT(ProcName)AS PROC_COUNT from RejectTemp ' +
'group by Year, Month, ProcName, UserID ' +
'order by Year, Month, ProcName, UserID';
end;
When this AdoQuery3 code executes I get the following error message;
'Project raised exception class EoleException with message ‘Syntax error in ‘ProcName selected Year’’. Process stopped. Use step or Run to continue.'
The SQL is fine - I've run it in Access and no problems, so what the heck is wrong?
Gratefull for any help as am getting to the 'punch the wall' stage...