以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 控件赋值出错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=130449) |
||||
-- 作者:lgj716330 -- 发布时间:2019/1/22 12:27:00 -- 控件赋值出错 Dim BMHZ As String = e.Form.Controls("ComboBox1").text \'赋于变量str在"BMLX"所选择的值
Dim bd2 As New SQLGroupTableBuilder("统计表2","同期预算") 以上是部分代码,通过MessageBox.Show()显示是这段有问题,出现以下错误提示
此主题相关图片如下:企业微信截图_15481310743050.png |
||||
-- 作者:有点甜 -- 发布时间:2019/1/22 12:30:00 -- 比如
bd2.Groups.AddDef(BMHZ,"{责任中心档案}.部门名称") \'根据型号分组
|
||||
-- 作者:lgj716330 -- 发布时间:2019/1/22 12:48:00 -- 还是一样的问题,以下是全部的代码
MessageBox.Show(1) Dim BMHZ As String = e.Form.Controls("ComboBox1").text Dim KMHZ As String = e.Form.Controls("ComboBox2").text
Dim tj21,tj22 As WinForm.CheckBox tj21 = Forms("部门科目同期预算").Controls("CheckBox1") tj22 = Forms("部门科目同期预算").Controls("CheckBox2")
Dim Filter As String = "1=1" With e.Form.Controls("BM") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If If BMHZ Is Nothing Then Filter = Filter & "部门名称 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf BMHZ = "部门名称" Then Filter = Filter & "部门名称 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf BMHZ = "上级汇总" Then Filter = Filter & "上级汇总 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf BMHZ = "一级汇总" Then Filter = Filter & "一级汇总 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf BMHZ = "公司汇总" Then Filter = Filter & "公司汇总 In ( \'" & .Value.replace(",","\',\'") & "\')" End If End If End With With e.Form.Controls("KM") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If If KMHZ Is Nothing Then Filter = Filter & "科目名称 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf KMHZ = "科目名称" Then Filter = Filter & "科目名称 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf KMHZ = "二级科目" Then Filter = Filter & "二级科目 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf KMHZ = "科目汇总" Then Filter = Filter & "科目汇总 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf KMHZ = "成本大类" Then Filter = Filter & "成本大类 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf KMHZ = "公司汇总" Then Filter = Filter & "公司汇总 In ( \'" & .Value.replace(",","\',\'") & "\')" End If End If End With
Dim Filter1 As String = "1=1" With e.Form.Controls("BM") If .Value IsNot Nothing Then If Filter1 > "" Then Filter1 = Filter1 & " And " End If If BMHZ Is Nothing Then Filter1 = Filter1 & "{责任中心档案}.部门名称 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf BMHZ = "部门名称" Then Filter1 = Filter1 & "{责任中心档案}.部门名称 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf BMHZ = "上级汇总" Then Filter1 = Filter1 & "{责任中心档案}.上级汇总 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf BMHZ = "一级汇总" Then Filter1 = Filter1 & "{责任中心档案}.一级汇总 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf BMHZ = "公司汇总" Then Filter1 = Filter1 & "{责任中心档案}.公司汇总 In ( \'" & .Value.replace(",","\',\'") & "\')" End If End If End With With e.Form.Controls("KM") If .Value IsNot Nothing Then If Filter1 > "" Then Filter1 = Filter1 & " And " End If If KMHZ Is Nothing Then Filter1 = Filter1 & "{费用科目档案}.科目名称 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf KMHZ = "科目名称" Then Filter1 = Filter1 & "{费用科目档案}.科目名称 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf KMHZ = "二级科目" Then Filter1 = Filter1 & "{费用科目档案}.二级科目 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf KMHZ = "科目汇总" Then Filter1 = Filter1 & "{费用科目档案}.科目汇总 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf KMHZ = "成本大类" Then Filter1 = Filter1 & "{费用科目档案}.成本大类 In ( \'" & .Value.replace(",","\',\'") & "\')" ElseIf KMHZ = "公司汇总" Then Filter1 = Filter1 & "{费用科目档案}.公司汇总 In ( \'" & .Value.replace(",","\',\'") & "\')" End If End If End With
MessageBox.Show(2) Dim jb1 As New SQLJoinTableBuilder("查询表1","辅助总账") jb1.AddTable("辅助总账","科目编码","科目档案","科目编号") jb1.AddTable("辅助总账", "部门编码","责任中心档案","部门编号") jb1.AddCols("科目编码","科目名称","一级科目","二级科目","科目汇总","成本大类","部门名称","上级汇总","一级汇总","公司汇总","部门属性","会计期间") jb1.AddExp("金额","贷方金额") jb1.Filter = "(科目编号 like \'6001%\' or 科目编号 like \'6051%\' or 科目编号 like \'6301%\') And (" & filter & ")"
Dim jb2 As New SQLJoinTableBuilder("查询表1","辅助总账") jb2.AddTable("辅助总账","科目编码","科目档案","科目编号") jb2.AddTable("辅助总账", "部门编码","责任中心档案","部门编号") jb2.AddCols("科目编码","科目名称","一级科目","二级科目","科目汇总","成本大类","部门名称","上级汇总","一级汇总","公司汇总","部门属性","会计期间") jb2.AddExp("金额","借方金额") jb2.Filter = "(科目编号 like \'6601%\' or 科目编号 like \'6602%\' or 科目编号 like \'6603%\') And (" & filter & ")"
jb1.Union(jb2,True) \'组合jb2 jb1.Build()
MessageBox.Show(3) Dim bd1 As New GroupTableBuilder("统计表1",DataTables("查询表1")) Dim dt1 As fxDataSource If tj21.Checked=True And tj22.Checked=False Then bd1.Groups.AddDef(KMHZ,"科目名称") ElseIf tj22.Checked=True And tj21.Checked=False Then bd1.Groups.AddDef(BMHZ,"部门名称") Else bd1.Groups.AddDef(BMHZ,"部门名称") bd1.Groups.AddDef(KMHZ,"科目名称") End If bd1.Totals.AddDef("金额","本期") dt1 = bd1.BuildDataSource()
MessageBox.Show(4) Dim bd2 As New SQLGroupTableBuilder("统计表2","同期预算") Dim dt2 As fxDataSource bd2.AddTable("同期预算","部门名称","责任中心档案","部门名称") bd2.AddTable("同期预算","科目名称","费用科目档案","科目名称") If tj21.Checked=True And tj22.Checked=False Then bd2.Groups.AddDef(KMHZ,"{费用科目档案}.科目名称") ElseIf tj22.Checked=True And tj21.Checked=False Then bd2.Groups.AddDef(BMHZ,"{责任中心档案}.部门名称") Else bd2.Groups.AddDef(BMHZ,"{责任中心档案}.部门名称") bd2.Groups.AddDef(KMHZ,"{费用科目档案}.科目名称") End If bd2.Totals.AddDef("同期金额","同期") bd2.Filter = filter1 dt2 = bd2.BuildDataSource()
MessageBox.Show(5) Dim nms As String() = {BMHZ,KMHZ} dt1.Combine(nms,dt2,nms)
此主题相关图片如下:企业微信截图_15481324246364.png [此贴子已经被作者于2019/1/22 13:16:59编辑过]
|
||||
-- 作者:有点甜 -- 发布时间:2019/1/22 14:41:00 -- 下面地方都要处理
jb1.AddCols("科目编码","科目名称","一级科目","二级科目","科目汇总","成本大类","部门名称","上级汇总","一级汇总","公司汇总","部门属性","会计期间")
jb2.AddCols("科目编码","科目名称","一级科目","二级科目","科目汇总","成本大类","部门名称","上级汇总","一级汇总","公司汇总","部门属性","会计期间")
如果还有问题,做一个对应实例发上来测试。 |
||||
-- 作者:lgj716330 -- 发布时间:2019/1/22 15:12:00 --
麻烦再帮我看下,搞了一天搞不定 |
||||
-- 作者:有点甜 -- 发布时间:2019/1/22 15:39:00 -- 比如
MessageBox.Show(4) MessageBox.Show(5) |
||||
-- 作者:lgj716330 -- 发布时间:2019/1/22 15:54:00 --
还是有问题 |
||||
-- 作者:有点甜 -- 发布时间:2019/1/22 15:56:00 -- 请说明测试步骤?
我这样测试没问题:选择【部门名称】、【科目名称】,勾选 【分科目】【分部门】,点击按钮测试。
|
||||
-- 作者:lgj716330 -- 发布时间:2019/1/22 16:17:00 -- 我这里最后显示以下错误 此主题相关图片如下:企业微信截图_15481448854523.png 此主题相关图片如下:企业微信截图_15481454935835.png [此贴子已经被作者于2019/1/22 16:25:17编辑过]
|
||||
-- 作者:有点甜 -- 发布时间:2019/1/22 16:18:00 -- 请说明测试步骤?
我这样测试没问题:选择【部门名称】、【科目名称】,勾选 【分科目】【分部门】,点击按钮测试。 |