📄 frmoperator.frm
字号:
DB.Close
ConfigGrid
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
frmOperator.HelpContextID = 5
GetFormSet Me, frmMain
'配置网格
Grid1.Visible = False
Grid1.Cols = 2
Grid1.FormatString = "^ 操作员 |^ 口令 "
Grid1.ColWidth(0) = 800
Grid1.ColWidth(1) = 1210
Dim DB As Database, EF As Recordset, HH As Integer
Dim shiftStr As String, shiftStrL As String, shiftStrR As String, shiftNum As Integer, ili As Integer, tempStr As String, SureStr As String, Qy As Integer
Set DB = OpenDatabase(ConData, False, False, Constr)
Set EF = DB.OpenRecordset("MAIN", dbOpenTable)
DelNO = EF.RecordCount
Grid1.Rows = EF.RecordCount + 4
Set EF = DB.OpenRecordset("Select * From MAIN", dbOpenDynaset)
HH = 1
Do While Not EF.EOF()
Grid1.Row = HH
Grid1.Col = 0
Grid1.CellAlignment = 1
If Not IsNull(EF.Fields(0).Value) Then
Grid1.Text = EF.Fields(0).Value
UserStr = Grid1.Text
End If
Grid1.Row = HH
Grid1.Col = 1
Grid1.CellAlignment = 1
If Not IsNull(EF.Fields(1).Value) Then
'解口令为可视
shiftStr = Trim(EF.Fields(1).Value)
shiftNum = Len(shiftStr)
ili = 1
SureStr = ""
Qy = 0
For ili = 1 To shiftNum
shiftStrR = Mid(shiftStr, ili, 1)
shiftStrR = Asc(shiftStrR)
shiftStrR = shiftStrR + 3
shiftStrR = Chr(shiftStrR)
SureStr = SureStr & shiftStrR
Next
'因为是超级用户,所以可以看见所有的帐号密码
Grid1.Text = SureStr
End If
EF.MoveNext
HH = HH + 1
Loop
DB.Close
Grid1.Col = 0
Grid1.Row = 1
Grid1.ColSel = 1
Grid1.Visible = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveFormSet Me
End Sub
Private Sub Grid1_DblClick()
If Grid1.Text = "" Then
MnuDelete.Enabled = False
MnuAuthority.Enabled = False
cmdModify.Enabled = False
mnuModify.Enabled = False
Else
MnuDelete.Enabled = True
MnuAuthority.Enabled = True
mnuModify.Enabled = True
cmdModify.Enabled = True
End If
PopupMenu MnuOperate
End Sub
Private Sub Grid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Grid1.Text = "" Then
MnuDelete.Enabled = False
MnuAuthority.Enabled = False
mnuModify.Enabled = False
cmdModify.Enabled = False
Else
MnuDelete.Enabled = True
MnuAuthority.Enabled = True
mnuModify.Enabled = True
cmdModify.Enabled = True
End If
If Button = 2 Then
PopupMenu MnuOperate
End If
End Sub
Private Sub MnuAuthority_Click()
Me.MousePointer = 11
frmAuthority.Show 1
Me.MousePointer = 0
End Sub
Private Sub MnuDelete_Click()
DeleteRecord
End Sub
Private Sub mnuModify_Click()
cmdModify_Click
End Sub
Private Sub MnuReturn_Click()
Unload Me
End Sub
Private Sub Text1_Change()
If cmdModify.Caption = "修改(&M)" Then
If Trim(Text1.Text) <> "" Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Trim(Text1.Text) <> "" Then
SendKeys "{tab}"
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
End If
End Sub
Private Sub Text3_LostFocus()
If Trim(Text3.Text) <> Trim(Text2.Text) Then
MsgBox "两次口令不符,请重新再来 ", vbOKOnly + 64, "口令不符"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
End If
End Sub
Private Sub DeleteRecord()
On Error Resume Next
If Grid1.Text = "" Or Grid1.MouseRow = 0 Then Exit Sub
'超级用户时
If Grid1.Text = "超级用户" Then
MsgBox "超级用户不能删除,只能修改其密码! ", vbOKOnly + 32, "不能删除"
Exit Sub
End If
If DelNO = 1 Then
MsgBox "仅剩下当前用户了,不能继续,请注意! ", vbOKOnly + 32, "不能删除"
Exit Sub
End If
Dim Qp As Integer
Qp = MsgBox("真的要删除[" & Grid1.Text & "]操作员吗(Y/N)?", vbYesNo + 16, "确认删除")
If Qp = 7 Then
Exit Sub
End If
Dim DB As Database, RecStr As String
Set DB = OpenDatabase(ConData, False, False, Constr)
RecStr = "Delete * From Main Where 操作员='" & Grid1.Text & "'"
DB.Execute RecStr
DB.Close
'配置网格
Grid1.Visible = False
Grid1.Clear
Grid1.Cols = 2
Grid1.FormatString = "^ 操作员 |^ 口令 "
Grid1.ColWidth(0) = 800
Grid1.ColWidth(1) = 1210
Dim EF As Recordset, HH As Integer
Dim shiftStr As String, shiftStrL As String, shiftStrR As String, shiftNum As Integer, ili As Integer, tempStr As String, SureStr As String, Qy As Integer
Set DB = OpenDatabase(ConData, False, False, Constr)
Set EF = DB.OpenRecordset("MAIN", dbOpenTable)
DelNO = EF.RecordCount
Grid1.Rows = EF.RecordCount + 4
Set EF = DB.OpenRecordset("Select * From MAIN", dbOpenDynaset)
HH = 1
Do While Not EF.EOF()
Grid1.Row = HH
Grid1.Col = 0
Grid1.CellAlignment = 1
If Not IsNull(EF.Fields(0).Value) Then
Grid1.Text = EF.Fields(0).Value
UserStr = Grid1.Text
End If
Grid1.Row = HH
Grid1.Col = 1
Grid1.CellAlignment = 1
If Not IsNull(EF.Fields(1).Value) Then
'解口令为可视
shiftStr = Trim(EF.Fields(1).Value)
shiftNum = Len(shiftStr)
ili = 1
SureStr = ""
Qy = 0
For ili = 1 To shiftNum
shiftStrR = Mid(shiftStr, ili, 1)
shiftStrR = Asc(shiftStrR)
shiftStrR = shiftStrR + 3
shiftStrR = Chr(shiftStrR)
SureStr = SureStr & shiftStrR
Next
'因为是超级用户,所以可以看见所有的帐号密码
Grid1.Text = SureStr
End If
EF.MoveNext
HH = HH + 1
Loop
DB.Close
Grid1.Col = 0
Grid1.Row = 1
Grid1.ColSel = 1
Grid1.Visible = True
End Sub
Private Sub ConfigGrid()
'配置网格
Grid1.Visible = False
Grid1.Clear
Grid1.Cols = 2
Grid1.FormatString = "^ 操作员 |^ 口令 "
Grid1.ColWidth(0) = 800
Grid1.ColWidth(1) = 1210
Dim DB As Database
Dim HH As Integer
SureStr = ""
shiftStr = ""
shiftStrL = ""
shiftStrR = ""
shiftNum = 0
ili = 0
tempStr = ""
Qy = 0
Set DB = OpenDatabase(ConData, False, False, Constr)
Set EF = DB.OpenRecordset("MAIN", dbOpenTable)
DelNO = EF.RecordCount
Grid1.Rows = EF.RecordCount + 4
Set EF = DB.OpenRecordset("Select * From MAIN", dbOpenDynaset)
HH = 1
Do While Not EF.EOF()
Grid1.Row = HH
Grid1.Col = 0
Grid1.CellAlignment = 1
If Not IsNull(EF.Fields(0).Value) Then
Grid1.Text = EF.Fields(0).Value
UserStr = Grid1.Text
End If
Grid1.Row = HH
Grid1.Col = 1
Grid1.CellAlignment = 1
If Not IsNull(EF.Fields(1).Value) Then
'解口令为可视
shiftStr = Trim(EF.Fields(1).Value)
shiftNum = Len(shiftStr)
ili = 1
SureStr = ""
Qy = 0
For ili = 1 To shiftNum
shiftStrR = Mid(shiftStr, ili, 1)
shiftStrR = Asc(shiftStrR)
shiftStrR = shiftStrR + 3
shiftStrR = Chr(shiftStrR)
SureStr = SureStr & shiftStrR
Next
'因为是超级用户,所以可以看见所有的帐号密码
Grid1.Text = SureStr
End If
EF.MoveNext
HH = HH + 1
Loop
DB.Close
Grid1.Col = 0
Grid1.Row = 1
Grid1.ColSel = 1
Grid1.Visible = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -