以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 请大师指教!谢谢! (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=97565) |
-- 作者:jackyfashion -- 发布时间:2017/3/14 21:57:00 -- 请大师指教!谢谢! 您好大师!我有两个表,一个是Tables("susrnydcge"),另一个是Tables("nyfgge"),觉得代码太长,请求大师代为优化.谢谢!!! Dim t As Table = Tables("susrnydcge") If t.Rows.Count = 0 Then Return Else Dim a = t.Current Dim ny1 = a("nydc1") Dim ny2 = a("nydc2") Dim ny3 = a("nydc3") Dim ny4 = a("nydc4") Dim ny5 = a("nydc5") Dim ny6 = a("nydc6") Dim ny7 = a("nydc7") Dim ny8 = a("nydc8") Dim ny9 = a("nydc9") Dim ny10 = a("nydc10") With Tables("nyfgge") .Cols("nydc1").Caption = ny1 .Cols("nydc2").Caption = ny2 .Cols("nydc3").Caption = ny3 .Cols("nydc4").Caption = ny4 .Cols("nydc5").Caption = ny5 .Cols("nydc6").Caption = ny6 .Cols("nydc7").Caption = ny7 .Cols("nydc8").Caption = ny8 .Cols("nydc9").Caption = ny9 .Cols("nydc10").Caption = ny10 .BuildHeader() End With With Tables("nyfgge") If a.Isnull("nydc1") = True Then .Cols("nydc1").Visible = False Else .Cols("nydc1").Visible = True End If If a.Isnull("nydc2") = True Then .Cols("nydc2").Visible = False Else .Cols("nydc2").Visible = True End If If a.Isnull("nydc3") = True Then .Cols("nydc3").Visible = False Else .Cols("nydc3").Visible = True End If If a.Isnull("nydc4") = True Then .Cols("nydc4").Visible = False Else .Cols("nydc4").Visible = True End If If a.Isnull("nydc5") = True Then .Cols("nydc5").Visible = False Else .Cols("nydc5").Visible = True End If If a.Isnull("nydc6") = True Then .Cols("nydc6").Visible = False Else .Cols("nydc6").Visible = True End If If a.Isnull("nydc7") = True Then .Cols("nydc7").Visible = False Else .Cols("nydc7").Visible = True End If If a.Isnull("nydc8") = True Then .Cols("nydc8").Visible = False Else .Cols("nydc8").Visible = True End If If a.Isnull("nydc9") = True Then .Cols("nydc9").Visible = False Else .Cols("nydc9").Visible = True End If If a.Isnull("nydc10") = True Then .Cols("nydc10").Visible = False Else .Cols("nydc10").Visible = True End If End With End If |
-- 作者:有点蓝 -- 发布时间:2017/3/14 22:11:00 -- Dim t As Table = Tables("susrnydcge") If t.Rows.Count = 0 Then Return Else Dim a = t.Current Dim c As strig = "nydc" With Tables("nyfgge") For i As Integer = 1 To 10 .Cols(c & i).Caption = a(c & i) .Cols(c & i).Visible = (a.Isnull(c & i) = False) Next End With End If
[此贴子已经被作者于2017/3/14 22:11:12编辑过]
|
-- 作者:jackyfashion -- 发布时间:2017/3/15 0:31:00 -- 谢谢大师指教!!! |