📄 frmcyzc.frm
字号:
VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form frmcyzc
Caption = "用户管理"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdExit
Cancel = -1 'True
Caption = "关闭"
Height = 360
Left = 6000
TabIndex = 13
Tag = "确定"
Top = 4440
Width = 1380
End
Begin VB.Frame Frame1
Height = 3975
Left = 600
TabIndex = 0
Top = 240
Width = 6855
Begin VB.CheckBox chkZt
Caption = "暂停使用"
Height = 255
Left = 2280
TabIndex = 8
Top = 1560
Width = 1215
End
Begin VB.TextBox txtBz
Height = 1335
Left = 2160
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 7
Top = 2280
Width = 3135
End
Begin VB.CommandButton cmdDel
Caption = "删除(&D)"
Height = 375
Left = 4560
TabIndex = 6
Top = 720
Width = 1275
End
Begin VB.CommandButton cmdAdd
Caption = "添加(&A)"
Height = 375
Left = 4560
TabIndex = 5
Top = 240
Width = 1275
End
Begin VB.TextBox txtPassword
Height = 300
IMEMode = 3 'DISABLE
Left = 2160
MaxLength = 8
PasswordChar = "*"
TabIndex = 4
Top = 720
Width = 1935
End
Begin VB.TextBox txtName
Height = 300
Left = 2160
MaxLength = 8
TabIndex = 3
Top = 240
Width = 1935
End
Begin VB.CheckBox chkQx
Caption = "管理个人帐务"
Enabled = 0 'False
Height = 255
Left = 2280
TabIndex = 2
TabStop = 0 'False
Top = 1200
Width = 1575
End
Begin MSDataListLib.DataList dblCyqd
Height = 1740
Left = 120
TabIndex = 1
Top = 840
Width = 1335
_ExtentX = 2355
_ExtentY = 3069
_Version = 393216
ListField = ""
BoundColumn = ""
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "备注:"
Height = 180
Index = 3
Left = 2400
TabIndex = 12
Top = 1920
Width = 450
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "密码:"
Height = 180
Index = 1
Left = 1560
TabIndex = 11
Top = 720
Width = 450
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "姓名:"
Height = 180
Index = 0
Left = 1560
TabIndex = 10
Top = 240
Width = 450
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "家庭成员:"
Height = 180
Index = 2
Left = 240
TabIndex = 9
Top = 480
Width = 810
End
End
End
Attribute VB_Name = "frmcyzc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim WithEvents rs As ADODB.Recordset
Attribute rs.VB_VarHelpID = -1
Dim mstrZpFile As String
Private Sub cmdAdd_Click()
'追加新记录
rs.AddNew
rs("姓名") = txtName.Text
rs("管理权") = 0
rs("停用状态") = 1
txtName.SetFocus
End Sub
Private Sub cmdDel_Click()
'删除记录
If Not (rs.EOF Or rs.BOF) Then
rs.Delete
rs.MoveNext
End If
End Sub
Private Sub cmdExit_Click()
On Error Resume Next
rs.Update
Unload Me
End Sub
Private Sub dblCyqd_Click()
Dim strName As String
strName = dblCyqd.Text
rs.MoveFirst
rs.Find "姓名='" & strName & "'"
End Sub
Private Sub Form_Load()
On Error Resume Next
DbeJcgl.rscydj.Open
Set rs = DbeJcgl.rscydj
Set dblCyqd.RowSource = rs
dblCyqd.ListField = "姓名"
Set txtName.DataSource = rs
txtName.DataField = "姓名"
Set txtPassword.DataSource = rs
txtPassword.DataField = "密码"
Set txtBz.DataSource = rs
txtBz.DataField = "备注"
Set chkZt.DataSource = rs
chkZt.DataField = "停用状态"
Set chkQx.DataSource = rs
chkQx.DataField = "管理权"
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Error Resume Next
If rs.EditMode = adEditAdd Or rs.EditMode = adEditInProgress Then
Cancel = 1
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
rs.Close
Set rs = Nothing
End Sub
Private Sub rs_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
If rs.AbsolutePosition < 1 Then
txtName.Enabled = False
txtPassword.Enabled = False
chkZt.Enabled = False
txtBz.Enabled = False
cmdDel.Enabled = False
Else
txtName.Enabled = True
txtPassword.Enabled = True
txtBz.Enabled = True
If rs("管理权") = 1 Then
cmdDel.Enabled = False
chkZt.Enabled = False
Else
cmdDel.Enabled = True
chkZt.Enabled = True
End If
End If
End Sub
Private Sub txtName_LostFocus()
'检验数据
On Error GoTo errBar
rs.Update
If Trim(rs("姓名")) = "" Then
rs.Delete
rs.MoveNext
End If
errBar:
If Err = -2147467259 Then
MsgBox "姓名发生冲突", vbExclamation
txtName.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -