您好大师!我有两个表,一个是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
|