加入一句代码,你去看你的授权表是否有对应的用户名。
For Each t As Table In Tables '在此开始....
t.Visible = True
t.AllowEdit = True
For Each c As Col In t.Cols
c.Visible = True
c.AllowEdit = True
Next
Next
MsgBox("Name = '" & _UserName & "'")
For Each dl As DataRow In DataTables("授权表").Select("Name = '" & _UserName & "'" )
If dl.IsNull("列名") Then
Tables(dl("表名")).Visible = Not dl("不可见")
Tables(dl("表名")).AllowEdit = Not dl("不可编辑")
Else
Tables(dl("表名")).Cols(dl("列名")).Visible = Not dl("不可见")
Tables(dl("表名")).Cols(dl("列名")).AllowEdit = Not dl("不可编辑")
End If
Next