|
roych老师你,我子窗体数据源是这样:
SELECT format([Forms]![应收款对账表]![开始日期],"YYYY-MM-DD")&"之前" as 日期, null as 凭证号,"上期应收款" as 类型, null as 客户,null as 品名,null as 颜色,0 as 匹数,0 as 重量,0 as 单价,null as 备注,null as 对数,sum([金额]) as 金额1
FROM 对账子表
WHERE 客户 like iif(isnull([Forms]![应收款对账表]![客户]),"*",[Forms]![应收款对账表]![客户]) and 日期<=[Forms]![应收款对账表]![开始日期]
UNION ALL SELECT format(日期,"YYYY-MM-DD") as 销售日期, 凭证号,类型,客户, 品名,颜色,匹数,重量,单价,备注,对数,金额
FROM 对账子表
WHERE 客户 like iif(isnull([Forms]![应收款对账表]![客户]),"*",[Forms]![应收款对账表]![客户]) and 日期>[Forms]![应收款对账表]![开始日期] and 对账子表.日期<=[Forms]![应收款对账表]![结束日期];
由于直接打印显示不了客户名称,求助你,按你报表数据源更改为下面:
SELECT Format([Forms]![应收款对账表]![开始日期],"yyyy-mm-dd") & "之前" AS 日期, 对账子表.凭证号,对账子表.类型,对账子表.客户,对账子表.品名,对账子表.颜色,对账子表.匹数,对账子表.重量,对账子表.单价,对账子表.备注,sum([金额]) as 金额1
FROM 对账子表
GROUP BY Format([Forms]![应收款对账表]![开始日期],"yyyy-mm-dd") & "之前",对账子表.凭证号,对账子表.类型,对账子表.客户,对账子表.品名,对账子表.颜色,对账子表.匹数,对账子表.重量,对账子表.单价,对账子表.备注,对账子表.金额
HAVING (((对账子表.客户)=[Forms]![应收款对账表]![客户]));
UNION ALL SELECT format(日期,"YYYY-MM-DD") as 销售日期, 凭证号,类型,客户, 品名,颜色,匹数,重量,单价,备注,金额
FROM 对账子表
WHERE 客户 like iif(isnull([Forms]![应收款对账表]![客户]),"*",[Forms]![应收款对账表]![客户]) and 日期>[Forms]![应收款对账表]![开始日期] and 对账子表.日期<=[Forms]![应收款对账表]![结束日期];
打印出来的结果不是我要的结果,该怎么改"报表数据源".你分析上面的两个问题,我都弄昏了,你就直接帮我修改一下吧!谢谢! |
|