'字段2-33为各省份权限标志,值为1则有权限
'checkbox从2-33为对应省份的权限
'循环使用Controls给各Checkbox赋值
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim table As String, i As Integer, n As Integer
table = "用户列表"
Label2.Caption = "用户名"
cnn.Open "provider=microsoft.ace.oledb.12.0;data source=" & ThisWorkbook.Path & "\客户资料\log.accdb" & "; Jet OLEDB:Database Password=password"
Set rst = New ADODB.Recordset
rst.Open table, cnn, adOpenKeyset, adLockOptimistic
'******指针移动到第一条记录
rst.MoveFirst
For i = 1 To rst.RecordCount '******遍历所有记录******
rst.MoveNext
Next i
Set cnn = Nothing
Set rst = Nothing
End If