The "last condition" being And I.Size = ("Small" ) ?
How does it fail?
With a question mark or the wrong value?
What data type is LIneItem::Size?
yes, that is the last condition.
it fails with a ?. and the data type is text, the same as frame. and the calculation result type is number since it is a sum result.
It works when i quote the size file like this:ExecuteSQL ("SELECT sum (l.quantity)FROM \"lineitem\" AS lWhere l.fk_InvoiceNumber = ?AND l.\"size\" <> ?AND l.\"frame\" <> ?AND l.\"frame\" <> ?"; ""; "" ; INVOICE::pk_invoiceNumber ; "X-Large"; "No Frame" ; "Rolled Canvas")What is the reason for this. There is no space in the field name, so I can't explain this behavior.
Just a shot in the dark. Google SQL reserved words. Perhaps you need to quote them as you have done because one of the field names is a reserved word?
That's it. Size is a reserved word. It's really a good idea to quote all field and table occurrence names in the SQL expression rather thant have to keep checking to see if one of your names runs afoul of this issue.