Not sure if I grasped this properly or not but here goes .. buildString : string subTot : integer;
Build your query string / subTot applying tests as to what you add a field before applying it to your sql.text So test values of s1 .. s3 individually and then add them before putting the appropriate value in the buildString. e.g. something like if s1 <> null subTot then := subTot + s1; When ready buildString := ' select 'inttostr(subTot) + 'as TotalAmount'; whatever.close; whatever.sql.text := buildString; whatever.open; _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
