把代码写到项目事件 LoadUserSetting
Dim kms() As String = {"语文", "数学", "英语", "物理", "化学"}
Dim filter As String = "1=2"
For Each km As String In kms
filter += " or " & km & "科任 = '" & user.Name & "'"
Next
DataTables("学生成绩库").LoadFilter = filter
DataTables("学生成绩库").Load
For Each km As String In kms
Dim count As Integer = DataTables("学生成绩库").Compute("count(_Identify)", km & "科任 = '" & user.Name & "'")
Tables("学生成绩库").Cols(km & "科任").Visible = (count > 0)
Tables("学生成绩库").Cols(km & "成绩").Visible = (count > 0)
Next