|
Question : DSUM works from form but not query
|
|
I have a dsum field on my form like this...
=NZ(DSum("total","qrytimebydateOrders"),0)
which works fine, but i would like this used in the underlying query instead of directly from the form's field.
Here are some considerations...
- The query "qrytimebydateOrders", has criteria in the DATE field: Between [forms]![orders]![orderdate] And [forms]![orders]![shipdate]
- It also has: Like [forms]![orders]![project] in the PROJECT field
So, this query's information between 2 dates and whatever the project is in my form.
But, when i copy and paste: =NZ(DSum("total","qrytimebydateOrders"),0) into my query it doesnt show #error or #name, but it show's a value of 0 when it shouldnt be.
|
|
Answer : DSUM works from form but not query
|
|
The minute you place a calculated field in a query... The recordset is not updateable
see the MSDN article at the following link http://support.microsoft.com/default.aspx?scid=kb;en-us;328828
an exerpt from the above article --------------------------------------------------------------------------- When the query is calculating a sum, an average, a count, or other type of total on the values in a field, you cannot update data in the query. Also, you cannot update a query that references a field in the Update To row from a crosstab, a query, a select query, or a subquery that contains totals or aggregate functions. ------------------------------------------------------------------------
Take the calculation out of the query and place it on the form.
|
|
|
|