Tables("部门资金需求_Table1").DataSource = b.Build
For Each r As Col In Tables("部门资金需求_Table1").Cols
r.GrandTotal = r.IsNumeric
If IsInput.checked= True And r.Caption.Contains("周") Then
Dim DateValues() As String,rNewCaption As String
DateValues=r.Caption.Split("_")
Dim d1 As Date = new Date(Val(DateValues(0).Replace("年","")),1,1)
Dim WeekEnd As Date = d1.AddDays((Val(DateValues(2).replace("周",""))-1)*7)
Dim WeekStart As Date = WeekEnd.AddDays(-7)
If WeekStart < d1 Then WeekStart = d1
rNewCaption = DateValues(0) & "_" & DateValues(1) & "_" & DateValues(2) & "(" & WeekStart & "至" & WeekEnd & ")" & "_" & DateValues(3)
r.DataCol.Caption = rNewCaption
End If
Next
以上代码修改表头的标签失败是为什么,我想用代码修改交叉查询的值,我用MSGBOX输出rNewCaption 的值,已经是我要的结果
但就是显示不到TABLE上,还是交叉查后自动生成的表头