以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]统计错误 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=114370) |
-- 作者:lgj716330 -- 发布时间:2018/2/4 19:01:00 -- [求助]统计错误 Dim Filter1 As String = "1=1" \'设置筛选条件 With e.Form.Controls("DQ") If .Value IsNot Nothing Then If Filter1 > "" Then Filter1 = Filter1 & " And " End If Filter1 = Filter1 & "大区 In ( \'" & .Value.replace(",","\',\'") & "\')" End If End With With e.Form.Controls("YF1") \'在前一筛选条件控制下设置第二项筛选条件,其内容根据第一列的变化而变化 If .Value IsNot Nothing Then If Filter1 > "" Then Filter1 = Filter1 & " And " End If Filter1 = Filter1 & "月份 = \'" & .value & "\'" End If End With Dim b As New SQLCrossTableBuilder("统计表1","销售统计") Dim Cols1() As String = {"年度","月份","年份季节"} Dim Cols2() As String = {"年度","月份","年份季节"} b.AddTable("销售统计",Cols1,"新旧款进度",Cols2) b.AddTable("销售统计","店铺名称","责任中心档案","部门名称") b.HGroups.AddDef("大区") \'添加客户列用于水平分组 b.HGroups.AddDef("{销售统计}.月份") \'添加客户列用于水平分组 b.VGroups.AddDef("新旧款") \'添加产品列用于垂直分组,并设置了Pattern参数 b.Totals.AddDef("销售数量") \'添加数量列用于统计 b.Totals.AddDef("销售金额") \'添加数量列用于统计 b.Totals.AddDef("吊牌金额") \'添加数量列用于统计 b.Filter = Filter1 b.Build \'生成统计表 MainTable = Tables("统计表1") \'打开生成的统计表 选择月份筛选查询的时候出现以下错误,不知什么原因: 该特定字段“月份”可以参考SQL语句中FROM字句列表中的多个表 [此贴子已经被作者于2018/2/4 19:03:25编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/2/4 20:00:00 -- Filter1 = Filter1 & "月份 = \'" & .value & "\'"
改成
Filter1 = Filter1 & "{销售统计}.月份 = \'" & .value & "\'" |
-- 作者:lgj716330 -- 发布时间:2018/2/5 8:09:00 -- 嗯,解决,谢谢 |
-- 作者:lgj716330 -- 发布时间:2018/2/12 9:58:00 -- Dim Filter1 As String = "1=1" With e.Form.Controls("DQ") If .Value IsNot Nothing Then If Filter1 > "" Then Filter1 = Filter1 & " And " End If Filter1 = Filter1 & "大区 In ( \'" & .Value.replace(",","\',\'") & "\')" End If End With With e.Form.Controls("YF1") If .Value IsNot Nothing Then If Filter1 > "" Then Filter1 = Filter1 & " And " End If Filter1 = Filter1 & "{销售统计}.月份 = \'" & .value & "\'" End If End With Dim b As New SQLCrossTableBuilder("统计表1","销售统计") Dim Cols1() As String = {"年度","月份","年份季节"} Dim Cols2() As String = {"年度","月份","年份季节"} b.AddTable("销售统计",Cols1,"新旧款进度",Cols2) b.AddTable("销售统计","店铺名称","责任中心档案","部门名称") b.HGroups.AddDef("大区") b.HGroups.AddDef("{销售统计}.月份") b.VGroups.AddDef("新旧款") b.Totals.AddDef("销售数量") b.Filter = Filter1 b.Build Tables("销售货品结构分析_Table1").DataSource = b.BuildDataSource() 提示错误:别名‘月份’循环引用 当不用Tables("销售货品结构分析_Table1").DataSource = b.BuildDataSource()的时候是正常的 |
-- 作者:有点甜 -- 发布时间:2018/2/12 10:00:00 -- 删除 b.Build 再测试
|
-- 作者:lgj716330 -- 发布时间:2018/2/12 10:05:00 -- 哦,现在对了 |