请高手不吝指教,我有一个很重要的功能靠它来实现:
Dim n As String = Tables("综合统计").Cols(e.NewRange.ColSel).Name
Dim s as String()
Dim c As Integer
s = n.split("_")
Integer.TryParse(s(0).Replace("月",""),c)
If Vars("统计") = "会计科目" Then
If n.IndexOf("月_借") <> -1 Then
If Relations.Contains("zh_pz_d") Then
Relations.delete("zh_pz_d")
End If
If Relations.Contains("zh_pz") Then
Relations.delete("zh_pz")
End If
If Not Relations.Contains("zh_pz_j") Then
Relations.add("zh_pz_j",DataTables("综合统计").DataCols(Vars("统计")),DataTables("凭证录入").DataCols("借方科目"))
End If
Tables("综合统计.凭证录入").Filter = "[年度] = " & Vars("年度") & " and [月份] = " & c
End If
If n.IndexOf("月_贷") <> -1 Then
If Relations.Contains("zh_pz_j") Then
Relations.delete("zh_pz_j")
End If
If Relations.Contains("zh_pz") Then
Relations.delete("zh_pz")
End If
If Not Relations.Contains("zh_pz_d") Then
Relations.add("zh_pz_d",DataTables("综合统计").DataCols(Vars("统计")),DataTables("凭证录入").DataCols("贷方科目"))
End If
Tables("综合统计.凭证录入").Filter = "[年度] = " & Vars("年度") & " and [月份] = " & c
End If
Else
If Relations.Contains("zh_pz_j") Then
Relations.delete("zh_pz_j")
End If
If Relations.Contains("zh_pz_d") Then
Relations.delete("zh_pz_d")
End If
If Not Relations.Contains("zh_pz") Then
Relations.add("zh_pz",DataTables("综合统计").DataCols(Vars("统计")),DataTables("凭证录入").DataCols(Vars("统计")))
End If
Tables("综合统计.凭证录入").Filter = "[年度] = " & Vars("年度") & " and [月份] = " & c
End If
[此贴子已经被作者于2008-10-20 23:37:36编辑过]