-- 作者:朱女士
-- 发布时间:2021/1/29 9:34:00
-- 数据替换填充
老师您好!
我今天的问题与昨天的问题类似。有个数据表分类型统计,可是我统计完毕后数据准确,但填充不到表中。我是用客户名称作为字段名,将大客户数据单独列出,将其他小客户归类为其他。代码和表界面如下:
If wr("二级代码")="a020" \' 原料费用之累计和选月合计费用, 按实际发生 For Each km As String In kms \'大客户累计层压木纸板原料 ylkje1= Tables("ylckb").Compute("Sum(出库_含税额)","[ckdate]>= #" & dt0 & "# and [ckdate]<= #" & dt3 & "# and [客户]=\'" & km & "\'And substring([ddlb],1,1)=\'c \'") ylkje2= Tables("ylckb").Compute("Sum(出库_含税额)","[ckdate]>= #" & dt0 & "# and [ckdate]<= #" & dt3 & "# and [客户]=\'" & km & "\'And substring([ddlb],1,1)=\'z \'") zd1=km+z1 zd2=km+z2 zd3=km+z3 zd4=km+z4 zd5=km+z5 wr(zd1)=ylkje1 wr(zd2)=ylkje2 kgh1= Tables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt0 & "# and [发货日期]<= #" & dt3 & "# and [客户]=\'" & km & "\'And substring([ddlb],1,1)=\'c \'" & " And 发货日期 Is Not null") kgh2= Tables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt0 & "# and [发货日期]<= #" & dt3 & "# and [客户]=\'" & km & "\'And substring([ddlb],1,1)=\'z \'" & " And 发货日期 Is Not null") wr(zd3)=ylkje1/kgh1 wr(zd4)=ylkje2/kgh2 wr(zd5)=ylkje1+ylkje2 \'\'选月 xkje1= Tables("ylckb").Compute("Sum(出库_含税额)","[ckdate]>= #" & dt1 & "# And [ckdate]<= #" & dt2 & "# and [客户]=\'" & km & "\'And substring([ddlb],1,1)=\'c \'") xkje2= Tables("ylckb").Compute("Sum(出库_含税额)","[ckdate]>= #" & dt1 & "# And [ckdate]<= #" & dt2 & "# and [客户]=\'" & km & "\'And substring([ddlb],1,1)=\'z \'") xkgh1= Tables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt1 & "# And [发货日期]<= #" & dt2 & "# and [客户]=\'" & km & "\'And substring([ddlb],1,1)=\'c \'" & " And 发货日期 Is Not null") xkgh2= Tables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt1 & "# And [发货日期]<= #" & dt2 & "# and [客户]=\'" & km & "\'And substring([ddlb],1,1)=\'z \'" & " And 发货日期 Is Not null") xzd1=km+xz1 xzd2=km+xz2 xzd3=km+xz3 xzd4=km+xz4 xzd5=km+xz5 wr(xzd1)=xkje1 wr(xzd2)=xkje2 wr(xzd3)=xkje1/xkgh1 wr(xzd4)=xkje2/xkgh2 wr(xzd5)=xkje1+xkje2 Next \'其他客户为大客户之外的小客户均为其他 \'\'累计 \'Dim qth As String \'qth="[客户]<>\'abb\' and [客户]<>\'魏德曼\' and [客户]<>\'博瑞\' and [客户]<>\'博驰\'and [客户]<>\'望变\'" kgh3=Tables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt0 & "# and [发货日期]<= #" & dt3 & "# And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'c\'" & "And 发货日期 Is Not null") kgh4=Tables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt0 & "# and [发货日期]<= #" & dt3 & "# And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'z\'" & "And 发货日期 Is Not null") ylkje3= Tables("ylckb").Compute("Sum(出库_含税额)","[ckdate]>= #" & dt0 & "# and [ckdate]<= #" & dt3 & "# And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'c\'") ylkje4= Tables("ylckb").Compute("Sum(出库_含税额)","[ckdate]>= #" & dt0 & "# and [ckdate]<= #" & dt3 & "# And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'z\'") \'\'选月 xkgh3=Tables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt1 & "# And [发货日期]<= #" & dt2 & "# and [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'c \'" & " And 发货日期 Is Not null") xkgh4=Tables("ddpsb").Compute("Sum(自产重量)","[发货日期]>= #" & dt1 & "# And [发货日期]<= #" & dt2 & "# and [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'z \'" & " And 发货日期 Is Not null") xkje3= Tables("ylckb").Compute("Sum(出库_含税额)","[ckdate]>= #" & dt1 & "# And [ckdate]<= #" & dt2 & "# and [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'c \'") xkje4= Tables("ylckb").Compute("Sum(出库_含税额)","[ckdate]>= #" & dt1 & "# And [ckdate]<= #" & dt2 & "# and [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'z \'") wr(qzd1)=ylkje3 wr(qzd2)=ylkje4 wr(qzd3)=ylkje3/kgh3 wr(qzd4)=ylkje4/kgh4 wr(qzd5)=ylkje3+ylkje4 wr(qxzd1)=xkje3 wr(qxzd2)=xkje4 wr(qxzd3)=xkje3/xkgh3 wr(qxzd4)=xkje4/xkgh4 wr(qxzd5)=xkje3+xkje4 End If
表界面的二级代码:“a020”行,“a040”行和"a060"行,其他累计数据和选月其他数据就是填充不上。
我找一天原因也没找到。谢谢指教! 此主题相关图片如下:问题界面1.png
|
-- 作者:有点蓝
-- 发布时间:2021/1/29 10:53:00
--
msgbox("[发货日期]>= #" & dt0 & "# and [发货日期]<= #" & dt3 & "# And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'c\'" & "And 发货日期 Is Not null") kgh3=Tables("ddpsb").Compute("Sum(自产重量)","[发货日期]>=
#" & dt0 & "# and [发货日期]<= #" & dt3 & "#
And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And
substring([ddlb],1,1)=\'c\'" & "And 发货日期 Is Not null") msgbox("[发货日期]>= #" & dt0 & "# and [发货日期]<= #" & dt3 & "# And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'z\'" & "And 发货日期 Is Not null") msgbox(kgh4)
kgh4=Tables("ddpsb").Compute("Sum(自产重量)","[发货日期]>=
#" & dt0 & "# and [发货日期]<= #" & dt3 & "#
And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And
substring([ddlb],1,1)=\'z\'" & "And 发货日期 Is Not null") msgbox("[ckdate]>= #" & dt0 & "# and [ckdate]<= #" & dt3 & "# And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'c\'") msgbox(ylkje3)
ylkje3=
Tables("ylckb").Compute("Sum(出库_含税额)","[ckdate]>=
#" & dt0 & "# and [ckdate]<= #" & dt3 &
"# And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And
substring([ddlb],1,1)=\'c\'") msgbox("[ckdate]>= #" & dt0 & "# and [ckdate]<= #" & dt3 & "# And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And substring([ddlb],1,1)=\'z\'") msgbox(ylkje4)
ylkje4=
Tables("ylckb").Compute("Sum(出库_含税额)","[ckdate]>=
#" & dt0 & "# and [ckdate]<= #" & dt3 &
"# And [客户] Not In (\'abb\',\'魏德曼\',\'博瑞\',\'博驰\',\'望变\') And
substring([ddlb],1,1)=\'z\'")
|