以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 加了个时间条件 出错了 麻烦帮我看一下 谢谢 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=180050) |
-- 作者:jswjyjf -- 发布时间:2022/9/25 21:08:00 -- 加了个时间条件 出错了 麻烦帮我看一下 谢谢 Dim dt1 As Date Dim dt2 As Date dt1=Forms("盘后作业").Controls("startdate").value dt2=Forms("盘后作业").Controls("enddate").value Dim Filter ="日期 >=\'" & dt1 & "\' And 日期 <=\'" & dt2 & "\'" & " and 单据状态=\'已审核\'" Tables(e.form.Name & "_Table1").fill("selec a.单据号,a.客户编码,a.客户名称,数量 as 列表数量,辅助数量 as 明细数量,金额 as 列表金额,明细金额 from {销售单} As a where "& filter &" full join (Selec 单据号,客户编码,sum(辅助数量) As 辅助数量,sum(金额) As 明细金额 from {销售单明细} where "& filter &" group by 单据号,客户编码) As b on a.单据号 = b.单据号 where (a.数量<> b.辅助数量 Or a.金额<>b.明细金额) And a.单据状态=\'已审核\'","wjhansdata",True) If Tables(e.form.Name & "_Table1").Current Is Nothing messagebox.show("列表和明细一致数据准确!","信息提示",MessageBoxButtons.ok) e.Form.close() End If 红字部分 去掉红字就正常
|
-- 作者:有点蓝 -- 发布时间:2022/9/25 22:12:00 -- "selec a.单据号,a.客户编码,a.客户名称,数量 as 列表数量,辅助数量 as 明细数量,金额 as 列表金额,明细金额 from {销售单} As a full join (Selec 单据号,客户编码,sum(辅助数量) As 辅助数量,sum(金额) As 明细金额 from {销售单明细} where "& filter &" group by 单据号,客户编码) As b on a.单据号 = b.单据号 where (a.数量<> b.辅助数量 Or a.金额<>b.明细金额) And a.单据状态=\'已审核\' and " & filter 或者 "selec a.单据号,a.客户编码,a.客户名称,数量 as 列表数量,辅助数量 as 明细数量,金额 as 列表金额,明细金额 from (select * from {销售单} where 单据状态=\'已审核\' and " & filter & ") As a full join (Selec 单据号,客户编码,sum(辅助数量) As 辅助数量,sum(金额) As 明细金额 from {销售单明细} where "& filter &" group by 单据号,客户编码) As b on a.单据号 = b.单据号 where (a.数量<> b.辅助数量 Or a.金额<>b.明细金额)"
|