回复 9 楼 风吹过 b
问题已经解决,但版主始终没有美白我的依稀看
字符串 要转换成 对象名使用
字符 = Trim(Adodc1.Recordset.Fields("二级目录名称"))
Set a = Controls(字符)
想问的是这个怎么写
a.Item(1).Enabled = False
Adodc1.Recordset.MoveNext
Dim 字符 As String
Adodc1.ConnectionString = strCn
If id_公司部门名称 = 5 Then
Command1.Visible = True
End If
'全部禁止访问目录
'=================================================
sql1 = "select 一级目录名称 from 系统一级目录 "
Adodc1.RecordSource = sql1
Adodc1.Refresh
For i = 1 To Adodc1.Recordset.RecordCount
字符 = Trim(Adodc1.Recordset.Fields("一级目录名称"))
Set a = Controls(字符)
a.Item(1).Enabled = False
Adodc1.Recordset.MoveNext
Next
sql1 = "select 二级目录名称 from 系统二级目录"
Adodc1.RecordSource = sql1
Adodc1.Refresh
For i = 1 To Adodc1.Recordset.RecordCount
字符 = Trim(Adodc1.Recordset.Fields("二级目录名称"))
Set a = Controls(字符)
a.Item(1).Enabled = False
Adodc1.Recordset.MoveNext
Next
'========================================
'=========================================
'查询职称对于一级目录的访问,放开一级目录的访问权限
sql1 = "select 一级目录名称 from 系统一级目录,一级目录访问 where 系统一级目录.id_一级目录=一级目录访问.id_一级目录 and id_公司部门名称 ='" & id_公司部门名称 & "'"
Adodc1.RecordSource = sql1
Adodc1.Refresh
For i = 1 To Adodc1.Recordset.RecordCount
字符 = Trim(Adodc1.Recordset.Fields("一级目录名称"))
Set a = Controls(字符)
a.Item(1).Enabled = True
Adodc1.Recordset.MoveNext
Next
'查询职称对于二级目录的访问,放开二级目录的访问权限
sql1 = "select 二级目录名称 from 系统二级目录,二级目录访问 where 系统二级目录.id_二级目录=二级目录访问.id_二级目录 and id_公司部门职称 ='" & id_公司部门职称 & "'"
Adodc1.RecordSource = sql1
Adodc1.Refresh
For i = 1 To Adodc1.Recordset.RecordCount
字符 = Trim(Adodc1.Recordset.Fields("二级目录名称"))
Set a = Controls(字符)
a.Item(1).Enabled = True
Adodc1.Recordset.MoveNext
Next
'=========================================访问权限结束