I need to calculate the total of a union all query. It works fine if I take out the ALL in the query but with the ALL in the query it returns an error??
Does the field that you are summing contain text or numbers? Just because the characters it contains are numbers, doesn't mean the field is numeric. I would force the field to be numeric in the UNION query by multiplying it by 1. For example:
Code:
SELECT *, [YourFieldNameHere]*1 AS NumericFieldName FROM FirstTableNameHere
UNION ALL
SELECT *, [YourFieldNameHere]*1 AS NumericFieldName FROM SecondTableNameHere;
It is a numeric field. What I can't work out is that when I take the "ALL" out of the query the DSum works fine, put the "ALL" back in and it returns #ERROR...