Hey,
This might work...though I'm not sure how efficient it will be...
You'll have to rebuild the string into your variable, by the way.SELECT SUM( CASE e.ResourceType WHEN '3' THEN (osd.NumImpressions * rFPSd.ResourceClickCharge) END ) AS [Total] FROM ((ResourceFPSDetail rFPSd INNER JOIN OrderStockDetail osd ON rFSPd.ResourceID=osd.ResourceID) INNER JOIN Equipment e ON e.ResourceID=rFPSd.ResourceID)
Oh, and you don't need to put "vbNewLine". The SQL query can be one long line without breaks.