Hi,
I am trying this query
rsOFF.Open "SELECT SUM(ISNULL(OFF_QUANT,0)*ISNULL(OFF_PRICE,0)) AS tot FROM dbo_OFF_ITEM WHERE DB_CONTRACT=" & Form_dbo_AE_CONTRACT1.DB_CONTRACT, CurrentProject.Connection, adOpenDynamic, adLockBatchOptimistic
but is is giving me this error:
Wrong number of argument used with function in query expression SUM(ISNULL(OFF_QUANT,0)*ISNULL(OFF_PRICE,0))
I could not find error.
can anyone help me.Not sure what is causing the error, but I doubt that you need the ISNULL functions anyway. If either value is Null then the product will be null and won't roll up into the SUM anyway. Aggregate functions ignore NULLs, so they are mathematically equivalent to zeros for summation.
Try simplifying your query statement to this, and see if it does not solve the problem:
rsOFF.Open "SELECT SUM(OFF_QUANT*OFF_PRICE) AS tot FROM dbo_OFF_ITEM WHERE DB_CONTRACT=" & Form_dbo_AE_CONTRACT1.DB_CONTRACT, CurrentProject.Connection, adOpenDynamic, adLockBatchOptimistic
Showing posts with label db_contract. Show all posts
Showing posts with label db_contract. Show all posts
Wednesday, March 21, 2012
Error in SQL Query
Subscribe to:
Posts (Atom)