📄 frm_czy.frm
字号:
VERSION 5.00
Begin VB.Form frm_czy
BackColor = &H0080C0FF&
BorderStyle = 3 'Fixed Dialog
Caption = "操作员初始化"
ClientHeight = 3870
ClientLeft = 45
ClientTop = 330
ClientWidth = 4005
Icon = "frm_czy.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3870
ScaleWidth = 4005
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command1
BackColor = &H00C0E0FF&
Height = 390
Index = 5
Left = 2520
MaskColor = &H00FFFFFF&
Picture = "frm_czy.frx":000C
Style = 1 'Graphical
TabIndex = 8
Top = 3225
UseMaskColor = -1 'True
Width = 1350
End
Begin VB.CommandButton Command1
BackColor = &H00C0E0FF&
Cancel = -1 'True
Height = 390
Index = 3
Left = 2520
MaskColor = &H00FFFFFF&
Picture = "frm_czy.frx":0FC6
Style = 1 'Graphical
TabIndex = 4
Top = 1710
UseMaskColor = -1 'True
Width = 1350
End
Begin VB.CommandButton Command1
BackColor = &H00C0E0FF&
Height = 390
Index = 4
Left = 2520
MaskColor = &H00FFFFFF&
Picture = "frm_czy.frx":3228
Style = 1 'Graphical
TabIndex = 7
Top = 2745
UseMaskColor = -1 'True
Width = 1350
End
Begin VB.TextBox Text1
BackColor = &H00C0E0FF&
Height = 300
IMEMode = 3 'DISABLE
Index = 0
Left = 150
MaxLength = 10
PasswordChar = "*"
TabIndex = 5
Top = 2760
Width = 2235
End
Begin VB.CommandButton Command1
BackColor = &H00C0E0FF&
Height = 390
Index = 2
Left = 2520
MaskColor = &H00FFFFFF&
Picture = "frm_czy.frx":4986
Style = 1 'Graphical
TabIndex = 3
Top = 1270
UseMaskColor = -1 'True
Width = 1350
End
Begin VB.CommandButton Command1
BackColor = &H00C0E0FF&
Height = 390
Index = 1
Left = 2520
MaskColor = &H00FFFFFF&
Picture = "frm_czy.frx":7170
Style = 1 'Graphical
TabIndex = 2
Top = 830
UseMaskColor = -1 'True
Width = 1350
End
Begin VB.CommandButton Command1
BackColor = &H00C0E0FF&
Default = -1 'True
Height = 390
Index = 0
Left = 2520
MaskColor = &H00FFFFFF&
Picture = "frm_czy.frx":9DA6
Style = 1 'Graphical
TabIndex = 1
Top = 390
UseMaskColor = -1 'True
Width = 1350
End
Begin VB.ListBox List1
BackColor = &H00C0E0FF&
Height = 1620
ItemData = "frm_czy.frx":C174
Left = 150
List = "frm_czy.frx":C176
TabIndex = 0
Top = 405
Width = 2235
End
Begin VB.TextBox Text1
BackColor = &H00C0E0FF&
Height = 300
IMEMode = 3 'DISABLE
Index = 1
Left = 150
MaxLength = 10
PasswordChar = "*"
TabIndex = 6
Top = 3427
Width = 2235
End
Begin VB.Line Line1
BorderColor = &H00FFFFFF&
Index = 1
X1 = 150
X2 = 3870
Y1 = 2340
Y2 = 2340
End
Begin VB.Line Line1
BorderColor = &H00404040&
Index = 0
X1 = 150
X2 = 3870
Y1 = 2325
Y2 = 2325
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "确认新密码:"
Height = 180
Index = 2
Left = 135
TabIndex = 11
Top = 3180
Width = 1080
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "新密码:"
Height = 180
Index = 1
Left = 150
TabIndex = 10
Top = 2505
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "操作员:"
Height = 180
Left = 150
TabIndex = 9
Top = 135
Width = 720
End
End
Attribute VB_Name = "frm_czy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Dim db As Database
Dim rec As Recordset
Private Sub Command1_Click(Index As Integer)
On Error GoTo jgqerr
Select Case Index
Case 0
yhm_add = InputBox("请输入您要增加的操作员姓名:", "增加操作员")
If Trim(yhm_add) = "" Or Len(yhm_add) > 4 Then
MsgBox "您输入的操作员姓名太长或为空", vbOKOnly + vbCritical, "错误"
Else
List1.AddItem Trim(yhm_add) + "(新)"
MsgBox "您已经增加了一个新操作员" + Chr(13) + "请在下面输入新增操作员的密码", vbOKOnly + vbInformation, "提示"
List1.ListIndex = List1.ListCount - 1
Command1_Click 2
Label2(1).Caption = "新密码(增加)"
End If
Case 1
yn = MsgBox("真的要删除『" + List1.Text + "』操作员吗?", vbYesNo + vbQuestion, "提示")
If yn = vbYes Then
sqlstr = "delete * from 权限表 where 用户='" + List1.Text + "'"
db.Execute sqlstr
List1.RemoveItem List1.ListIndex
MsgBox "删除成功!", vbOKOnly + vbInformation, "提示"
List1.ListIndex = 0
List1_Click
End If
Case 2
Text1(0).SetFocus
Me.Height = 4245
Text1(0).Text = ""
Text1(1).Text = ""
For i = 0 To 3
Command1(i).Enabled = False
Next i
List1.Enabled = False
Label2(1).Caption = "新密码(修改)"
Command1(4).Default = True
Command1(5).Cancel = True
Case 3
Unload Me
Case 4
If Text1(0) = Text1(1) Then
If Label2(1).Caption = "新密码(增加)" Then '增加密码
rec.AddNew
rec.Fields("用户") = Left(List1.Text, Len(List1.Text) - 3)
rec.Fields("密码") = Text1(0)
rec.Update
List1.Text = Left(List1.Text, Len(List1.Text) - 3)
MsgBox "操作员已经增加成功", vbOKOnly + vbInformation, "提示"
Else '修改密码
sqlstr = "update 权限表 set 密码='" + Text1(0) + "' where 用户='" + Pczy + "'"
db.Execute sqlstr
MsgBox "您修改的新密码已经生成", vbOKOnly + vbInformation, "提示"
End If
Else
MsgBox "密码确认错误,请重新确认!", vbOKOnly + vbCritical, "错误"
Text1(1).SetFocus
Exit Sub
End If
Me.Height = 2625
Command1(2).Enabled = True
List1.Enabled = True
List1.ListIndex = 0
List1_Click
Command1(0).Default = True
Command1(3).Cancel = True
Case 5
Me.Height = 2625
List1.Enabled = True
If Right(List1.Text, 3) = "(新)" Then
List1.RemoveItem List1.ListIndex
Else
End If
List1.ListIndex = 0
List1_Click
Command1(0).Default = True
Command1(3).Cancel = True
End Select
Exit Sub
jgqerr:
MsgBox Err.Description, vbOKOnly + vbCritical, "错误"
End Sub
Private Sub Form_Load()
'frm_main.Toolbar2.Buttons(1).Enabled = False
frm_main.czy.Enabled = False
'Set db = OpenDatabase(App.Path + "\datas\mry.mdb")
Set db = OpenDatabase(AppPath + "datas\mry.mdb", True, False, ";PWD=miracle")
Set rec = db.OpenRecordset("权限表")
Do While Not rec.EOF
List1.AddItem rec.Fields("用户")
rec.MoveNext
Loop
If List1.ListCount <> 0 Then
List1.ListIndex = 0
Else
End If
Me.Height = 2625
frmcen Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.czy.Enabled = True
'frm_main.Toolbar2.Buttons(1).Enabled = True
'db.Close
'Set db = Nothing
End Sub
Private Sub List1_Click()
If List1.Text <> Pczy Then
Command1(0).Enabled = True
Command1(1).Enabled = True
Command1(2).Enabled = False
Command1(3).Enabled = True
Else
Command1(0).Enabled = True
Command1(1).Enabled = False
Command1(2).Enabled = True
Command1(3).Enabled = True
End If
End Sub
Private Sub Text1_GotFocus(Index As Integer)
'Text1(Index).IMEMode = 2
'Text1(Index).SelStart = 0
'Text1(Index).SelLength = Len(Text1(Index))
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -