Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TAdoQuery driving me NUTS!

Status
Not open for further replies.

corsair2

IS-IT--Management
Feb 21, 2001
55
0
0
GB
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...
 
Me again, the idiot who posted the above!

Hope no-ones wasted any time over this as the problem was in my duff code.
Of course, I should have added 'SQL.Clear;' after the 'Close' instruction in 'With AdoQuery3 do begin'....

Please excuse my stupidity?

Regards

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top