📄 fmuser.frm
字号:
VERSION 5.00
Begin VB.Form fmuser
BackColor = &H00FFC0C0&
Caption = "管理员账号管理"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
Icon = "fmuser.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "C:\Documents and Settings\Administrator\桌面\11050302超市管理系统(033069,033068, 033067)\源代码\supermarket1.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 735
Left = 3720
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "Operatoradmin"
Top = 600
Visible = 0 'False
Width = 1140
End
Begin VB.CommandButton Command9
Caption = "末记录"
Height = 375
Left = 2880
TabIndex = 12
Top = 2160
Width = 735
End
Begin VB.CommandButton Command8
Caption = "首记录"
Height = 375
Left = 720
TabIndex = 11
Top = 2160
Width = 735
End
Begin VB.CommandButton Command7
Caption = "下一条"
Height = 375
Left = 2160
TabIndex = 10
Top = 2160
Width = 735
End
Begin VB.CommandButton Command6
Caption = "上一条"
Height = 375
Left = 1440
TabIndex = 9
Top = 2160
Width = 735
End
Begin VB.TextBox Text2
DataField = "pwd"
DataSource = "Data1"
Enabled = 0 'False
Height = 270
Left = 2280
TabIndex = 6
Top = 1080
Width = 1095
End
Begin VB.TextBox Text1
DataField = "name"
DataSource = "Data1"
Enabled = 0 'False
Height = 270
Left = 2280
TabIndex = 5
Top = 480
Width = 1095
End
Begin VB.CommandButton Command5
Height = 375
Left = 3600
Picture = "fmuser.frx":08CA
Style = 1 'Graphical
TabIndex = 4
Top = 1800
Width = 855
End
Begin VB.CommandButton Command4
DisabledPicture = "fmuser.frx":1456
Enabled = 0 'False
Height = 375
Left = 2640
Picture = "fmuser.frx":28DA
Style = 1 'Graphical
TabIndex = 3
Top = 1800
Width = 975
End
Begin VB.CommandButton Command3
Caption = "修改用户"
Height = 375
Left = 1800
Picture = "fmuser.frx":3D5E
Style = 1 'Graphical
TabIndex = 2
Top = 1800
Width = 855
End
Begin VB.CommandButton Command2
DisabledPicture = "fmuser.frx":51E2
Height = 375
Left = 960
Picture = "fmuser.frx":6666
Style = 1 'Graphical
TabIndex = 1
Top = 1800
Width = 855
End
Begin VB.CommandButton Command1
Caption = "添加用户"
Height = 375
Left = 120
Picture = "fmuser.frx":7AEA
Style = 1 'Graphical
TabIndex = 0
Top = 1800
Width = 855
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密码:"
Height = 255
Left = 960
TabIndex = 8
Top = 1080
Width = 1095
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户名:"
Height = 255
Left = 960
TabIndex = 7
Top = 480
Width = 975
End
End
Attribute VB_Name = "fmuser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error Resume Next
If Text1.Text = "" Then
MsgBox "用户名不能为空!"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "用户密码不能为空!"
Text2.SetFocus
Exit Sub
End If
Command2.Enabled = Not Command2.Enabled
Command3.Enabled = Not Command3.Enabled
Command4.Enabled = Not Command4.Enabled
Command5.Enabled = Not Command5.Enabled
Command6.Enabled = Not Command6.Enabled
Command7.Enabled = Not Command7.Enabled
Command8.Enabled = Not Command8.Enabled
Command9.Enabled = Not Command9.Enabled
If Command1.Caption = "添加用户" Then
Text1.Enabled = True
Text2.Enabled = True
Command1.Caption = "确认"
Data1.Recordset.AddNew
Text1.SetFocus
Else
Command1.Caption = "添加用户"
Text1.Enabled = False
Text2.Enabled = False
Data1.Recordset.Update
Data1.Recordset.MoveLast
Data1.Refresh
End If
End Sub
Private Sub Command2_Click()
On Error Resume Next
Data1.Recordset.Delete
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
End If
Data1.Refresh
End Sub
Private Sub Command3_Click()
On Error Resume Next
If Text1.Text = "" Then
MsgBox "用户名不能为空!"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "用户密码不能为空!"
Text2.SetFocus
Exit Sub
End If
Command1.Enabled = Not Command1.Enabled
Command2.Enabled = Not Command2.Enabled
Command4.Enabled = Not Command4.Enabled
Command5.Enabled = Not Command5.Enabled
Command6.Enabled = Not Command6.Enabled
Command7.Enabled = Not Command7.Enabled
Command8.Enabled = Not Command8.Enabled
Command9.Enabled = Not Command9.Enabled
If Command3.Caption = "修改用户" Then
Text1.Enabled = True
Text2.Enabled = True
Command3.Caption = "确认"
Data1.Recordset.Edit
Text1.SetFocus
Else
Text1.Enabled = False
Text2.Enabled = False
Command3.Caption = "修改用户"
Data1.Recordset.Update
Data1.Refresh
End If
End Sub
Private Sub Command4_Click()
On Error Resume Next
Command1.Caption = "添加用户"
Command3.Caption = "修改用户"
Text1.Enabled = False
Text2.Enabled = False
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = False
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Text1.Text = ""
Text2.Text = ""
Data1.UpdateControls
Data1.Recordset.MoveLast
Data1.Refresh
End Sub
Private Sub Command5_Click()
Dim mzy As String
mzy = InputBox$("请输入所账号的用户名:", "查找窗")
Data1.RecordSource = "select * from Operatoradmin where name ='" & mzy & "'"
Data1.Refresh
If Data1.Recordset.EOF Then
MsgBox "无此人!请确认后再输入!", , "提示"
Data1.RecordSource = "Operatoradmin"
Data1.Refresh
End If
End Sub
Private Sub Command6_Click()
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
End If
End Sub
Private Sub Command7_Click()
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
End If
End Sub
Private Sub Command8_Click()
Data1.Recordset.MoveFirst
End Sub
Private Sub Command9_Click()
Data1.Recordset.MoveLast
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -