📄 frm_mrs.frm
字号:
Top = 912
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "性别:"
Height = 180
Index = 1
Left = 276
TabIndex = 18
Top = 612
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名:"
Height = 180
Index = 0
Left = 270
TabIndex = 17
Top = 315
Width = 540
End
End
Begin VB.ListBox List1
BackColor = &H00C0E0FF&
Height = 3960
ItemData = "frm_mrs.frx":8246
Left = 90
List = "frm_mrs.frx":8248
TabIndex = 0
Top = 375
Width = 1680
End
Begin VB.PictureBox Picture2
BackColor = &H0080C0FF&
BorderStyle = 0 'None
Height = 615
Left = 90
ScaleHeight = 615
ScaleWidth = 5745
TabIndex = 26
Top = 4500
Visible = 0 'False
Width = 5745
Begin VB.CommandButton Command1
BackColor = &H00C0E0FF&
Height = 435
Index = 6
Left = 3255
MaskColor = &H00FFFFFF&
Picture = "frm_mrs.frx":824A
Style = 1 'Graphical
TabIndex = 28
Top = 60
UseMaskColor = -1 'True
Width = 1095
End
Begin VB.CommandButton Command1
BackColor = &H00C0E0FF&
Height = 435
Index = 5
Left = 1515
MaskColor = &H00FFFFFF&
Picture = "frm_mrs.frx":9204
Style = 1 'Graphical
TabIndex = 27
Top = 60
UseMaskColor = -1 'True
Width = 1095
End
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "所有美容师:"
Height = 180
Left = 96
TabIndex = 15
Top = 144
Width = 1080
End
End
Attribute VB_Name = "frm_mrs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rec As Recordset
Dim sta As Boolean
Dim yxm As String
Private Sub Command1_Click(Index As Integer)
On Error GoTo jgqerr
Select Case Index
Case 0
enab
Frame2.Visible = True
List1.Enabled = False
For i = 0 To Text1.Count - 1
Text1(i) = ""
Next i
MaskEdBox1(0).Text = "1978-08-25"
MaskEdBox1(1).Text = " 024-23996656"
Picture1.Visible = False
Picture2.Visible = True
Command1(5).Default = True
Command1(6).Cancel = True
Text1(0).SetFocus
rec.AddNew
sta = True
Case 1
yn = MsgBox("真的想删除『" + List1.Text + "』的资料吗?", vbYesNo + vbQuestion, "提示")
If yn = vbYes Then
rec.Delete
List1.RemoveItem List1.ListIndex
Else
End If
If List1.ListCount <> 0 Then
List1.ListIndex = 0
Else
List1.Enabled = False
For i = 1 To 3
Command1(i).Enabled = False
Next i
End If
Case 2
yxm = Trim(Text1(0))
enab
Frame2.Visible = False
List1.Enabled = False
Picture1.Visible = False
Picture2.Visible = True
Command1(5).Default = True
Command1(6).Cancel = True
Text1(0).SetFocus
rec.Edit
sta = False
Case 3
Frame2.Visible = False
xm = InputBox("请输入要查询的姓名:", "按姓名查询")
If Trim(xm) <> "" Then
rec.FindFirst "姓名 like '*" + xm + "*'"
If rec.NoMatch Then
MsgBox "没有您要查的美容师资料", vbOKOnly + vbInformation, "提示"
Else
'tr
For i = 0 To List1.ListCount - 1
If List1.List(i) = rec.Fields("姓名") Then
List1.ListIndex = i
Exit For
End If
Next i
End If
End If
Case 4
Unload Me
Case 5 '确定
If Trim(Text1(0)) = "" Then
MsgBox "请在第一栏输入操作员姓名", vbOKOnly + vbCritical, "错误"
Exit Sub
End If
If Frame2.Visible Then
If Text2(0) <> Text2(1) Or Text2(0) = "" Or Text2(1) = "" Then
MsgBox "您输入的密码不能确定", vbOKOnly + vbCritical, "错误"
Text2(1).SetFocus
Exit Sub
End If
End If
rec.Fields("姓名") = Trim(Text1(0))
rec.Fields("性别") = IIf(Option1(0).Value, "男", "女")
If IsDate(MaskEdBox1(0).Text) Then
rec.Fields("生日") = CDate(MaskEdBox1(0).Text)
Else
rec.Fields("生日") = Null
End If
rec.Fields("科室") = Trim(Text1(1))
rec.Fields("职称") = Trim(Text1(2))
rec.Fields("电话") = MaskEdBox1(1).Text
rec.Fields("地址") = Trim(Text1(3))
If Frame2.Visible Then
rec.Fields("密码") = Text2(0)
End If
rec.Update
Picture1.Visible = True
Picture2.Visible = False
disa
If sta = True Then
List1.AddItem Trim(Text1(0))
List1.ListIndex = List1.ListCount - 1
Else
If Trim(Text1(0)) <> yxm Then
ss
End If
End If
List1.Enabled = True
Command1(0).Default = True
Command1(4).Cancel = True
MsgBox "美容师资料保存成功", vbOKOnly + vbInformation, "提示"
Frame2.Visible = False
Case 6
rec.CancelUpdate
Picture1.Visible = True
Picture2.Visible = False
disa
If List1.ListCount <> 0 Then
List1.Enabled = True
List1.Selected(0) = True
List1_Click
Else
For i = 1 To 3
Command1(i).Enabled = False
Next i
List1.Enabled = False
End If
Command1(0).Default = True
Command1(4).Cancel = True
Frame2.Visible = False
End Select
Exit Sub
jgqerr:
MsgBox Err.Description, vbOKOnly + vbCritical, "错误"
End Sub
Private Sub Form_Load()
frm_main.mrs.Enabled = False
'frm_main.Toolbar2.Buttons(2).Enabled = False
ss
disa
frmcen Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.mrs.Enabled = True
'frm_main.Toolbar2.Buttons(2).Enabled = True
'db.Close
'Set db = Nothing
End Sub
Private Sub ss()
List1.Clear
Set rec = db.OpenRecordset("美容师人员表", dbOpenDynaset)
Do While Not rec.EOF
List1.AddItem rec.Fields("姓名")
rec.MoveNext
Loop
If List1.ListCount <> 0 Then
List1.ListIndex = 0
Else
For i = 1 To 3
Command1(i).Enabled = False
Next i
List1.Enabled = False
End If
End Sub
Private Sub List1_Click()
rec.FindFirst "姓名='" + List1.Text + "'"
If rec.NoMatch Then
MsgBox "没有该记录", vbOKOnly + vbInformation, "提示"
For i = 1 To 3
Command1(i).Enabled = False
Next i
Else
tr
For i = 0 To 4
Command1(i).Enabled = True
Next i
End If
End Sub
Private Sub tr()
Text1(0) = IIf(IsNull(rec.Fields("姓名")), "", rec.Fields("姓名"))
Option1(0).Value = IIf(rec.Fields("性别") = "男", True, False)
Option1(1).Value = Not Option1(0).Value
If IsNull(rec.Fields("生日")) Then
MaskEdBox1(0).Text = "____-__-__"
Else
MaskEdBox1(0).Text = Format(Str(rec.Fields("生日")), "yyyy-mm-dd")
End If
Text1(1) = IIf(IsNull(rec.Fields("科室")), "", rec.Fields("科室"))
Text1(2) = IIf(IsNull(rec.Fields("职称")), "", rec.Fields("职称"))
MaskEdBox1(1).Text = IIf(IsNull(rec.Fields("电话")), "", rec.Fields("电话"))
Text1(3) = IIf(IsNull(rec.Fields("地址")), "", rec.Fields("地址"))
End Sub
Private Sub disa()
For i = 0 To Text1.Count - 1
Text1(i).Enabled = False
Next i
Text2(0).Enabled = False
Text2(1).Enabled = False
Option1(0).Enabled = False
Option1(1).Enabled = False
MaskEdBox1(0).Enabled = False
MaskEdBox1(1).Enabled = False
End Sub
Private Sub enab()
For i = 0 To Text1.Count - 1
Text1(i).Enabled = True
Next i
Text2(0).Enabled = True
Text2(1).Enabled = True
Option1(0).Enabled = True
Option1(1).Enabled = True
MaskEdBox1(0).Enabled = True
MaskEdBox1(1).Enabled = True
End Sub
Private Sub MaskEdBox1_GotFocus(Index As Integer)
MaskEdBox1(Index).SelStart = 0
MaskEdBox1(Index).SelLength = Len(MaskEdBox1(Index).Text)
End Sub
Private Sub Text1_GotFocus(Index As Integer)
'Text1(Index).SelStart = 0
'Text1(Index).SelLength = Len(Text1(Index))
'Text1(Index).IMEMode = 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -