权限修改代码:
Option Explicit
Private moUserTable As Recordset
Private superno As String
Private Sub Command1_Click()
If username = DataCombo1.Text Then
MsgBox "不可以修改自身的权限", , "操作失败"
Exit Sub
End If
If DataCombo1.Text = "" Then
MsgBox "用户名不能为空", vbOKOnly, "操作失败"
Exit Sub
End If
If superadmin = "否" Then
MsgBox "您不是超级管理员无法执行本操作", , "操作失败"
Exit Sub
End If
With moUserTable
.Find "用户帐号 = '" & DataCombo1.Text & "'"
If .EOF Then
.Fields("超级用户") = superno
.Update
MsgBox "权限修改成功", vbOKOnly, "修改权限"
usermanage.Adodc1.Refresh
Else
MsgBox "权限修改失败", vbOKOnly, "操作失败"
End If
End With
End Sub
Private Sub command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
InitializeDataPath
Adodc1.ConnectionString = AdodcPath
Adodc1.RecordSource = "select * from usertable"
Adodc1.Refresh
Set moUserTable = Adodc1.Recordset
Option2.Value = True
Set DataCombo1.RowSource = Adodc1
DataCombo1.ListField = "用户帐号"
End Sub
Private Sub Option2_Click()
superno = "否"
End Sub
Private Sub Option3_Click()
superno = "是"
End Sub
帮忙看看是哪个地主出错了,就是改不了啊.