此查询运行项目分类帐。当我尝试使用 =SUM([Returns]) 对访问报告上的返回字段求和时,即返回是访问报告上的文本框。运行报告时显示以下错误。**
此表达式键入不正确,或者它太复杂而无法计算。例如,一个数值表达式可能包含太多复杂的元素。尝试通过将表达式的一部分分配给变量来简化表达式。
**
SELECT ITEM, [Transaction Date], ID, Reciept, Issued, Returns, Remarks, Manual
FROM
(SELECT t.item AS ITEM, irh.reciept_date AS [Transaction Date], ird.inv_id AS ID, ird.inv_qyt AS Reciept, Null AS Issued, NULL AS Returns, ird.remarks AS Remarks, ird.inv_manual_number AS Manual
FROM inventory_reciepts_header AS irh, inventory_reciepts_detail AS ird, inventory AS t
WHERE
ird.inv_id=t.id
AND ird.reciept_header_id=irh.id
UNION ALL
SELECT t.item AS ITEM, iih.issue_date As [Transaction Date], iid.inventory_id AS ID,NULL AS Reciept, iid.inventory_qyt AS Issued, NULL AS Returns, iid.remarks AS Remarks,Null AS Manual
FROM inventory_issue_header AS iih, inventory_issue_detail AS iid,inventory
AS t WHERE iid.inventory_id=t.id
AND
iid.issue_header_id=iih.id
UNION ALL
SELECT t.item AS ITEM, iirh.return_date As [Transaction Date], iir.item_id AS ID, Null AS Reciept, NULL AS Issued,iir.qyt AS Returns, iir.reasons AS Remarks,Null AS Manual
FROM inventory_return_header AS iirh, inventory_return_detail AS iir, inventory AS t
WHERE
iir.item_id=t.id
AND
iir.return_header_id=iirh.id
) AS [ITEM Ledger]
WHERE ID=[Forms]![Reports Window]![cmb_ar]
and
[Transaction Date] between [Forms]![Reports Window]![ar_frm_dt] And [Forms]![Reports Window]![ar_to_dt];