我想选择节点的时候按照节点标题切换相应的视图,错误提示如下:此主题相关图片如下:目录树.png
代码如下:(错误代码见黄色背景部分)
If e.Node.Text = "上海赫程国际旅行社有限公司南通分公司" OrElse e.Node.ParentNode.Text = "上海赫程国际旅行社有限公司南通分公司" Then
Tables("应收款明细").OpenView("携程视图")
ElseIf e.Node.Text = "直联商户待清算款项" OrElse e.Node.ParentNode.Text = "直联商户待清算款项" Then
Tables("应收款明细").OpenView("卡视图")
End If
Dim Filter As String
Dim dr As DataRow = e.Node.DataRow '获取生成此节点的行
If e.Node.Text <> "显示所有行" Then
Select Case e.Node.Level
Case 0
Filter = "[收款户名] = '" & dr("收款户名") & "'"
Case 1
Filter = "[收款户名] = '" & dr("收款户名") & "' And [消帐码] = '" & dr("消帐码") & "'"
Case 2
Filter = "[收款户名] = '" & dr("收款户名") & "' And [消帐码] = '" & dr("消帐码") & "' And [华住对账名称] = '" & dr("华住对账名称") & "'"
Case 3
Filter = "[收款户名] = '" & dr("收款户名") & "' And [消帐码] = '" & dr("消帐码") & "' And [华住对账名称] = '" & dr("华住对账名称") & "'And [方式] = '" & dr("方式") & "'"
Case 4
Filter = "[收款户名] = '" & dr("收款户名") & "' And [消帐码] = '" & dr("消帐码") & "' And [华住对账名称] = '" & dr("华住对账名称") & "'And [方式] = '" & dr("方式") & "'And [中介名称] = '" & dr("中介名称") & "'"
Case 5
Filter = "[收款户名] = '" & dr("收款户名") & "' And [消帐码] = '" & dr("消帐码") & "' And [华住对账名称] = '" & dr("华住对账名称") & "'And [方式] = '" & dr("方式") & "'And [中介名称] = '" & dr("中介名称") & "'And [年份] = '" & dr("年份") & "'"
Case 6
Filter = "[收款户名] = '" & dr("收款户名") & "' And [消帐码] = '" & dr("消帐码") & "' And [华住对账名称] = '" & dr("华住对账名称") & "'And [方式] = '" & dr("方式") & "'And [中介名称] = '" & dr("中介名称") & "'And [年份] = '" & dr("年份") & "'And [月份] = '" & dr("月份") & "'"
End Select
End If
Tables("应收款明细").Filter = Filter