📄 frmempman.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmEmpMan
BorderStyle = 1 'Fixed Single
Caption = "销售人员管理"
ClientHeight = 4950
ClientLeft = 45
ClientTop = 330
ClientWidth = 7410
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4950
ScaleWidth = 7410
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Cmd_Back
Cancel = -1 'True
Caption = "返 回"
Height = 400
Left = 6240
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 7
Top = 4320
Width = 1185
End
Begin VB.CommandButton Cmd_Del
Caption = "删 除"
Height = 400
Left = 4200
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 6
Top = 4320
Width = 1185
End
Begin VB.CommandButton Cmd_Add
Caption = "添 加"
Height = 400
Left = 120
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 5
Top = 4320
Width = 1185
End
Begin VB.CommandButton Cmd_Modi
Caption = "修 改"
Height = 400
Left = 2160
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 4
Top = 4320
Width = 1185
End
Begin VB.CheckBox Check1
Caption = "全部"
Height = 255
Left = 3480
TabIndex = 1
Top = 240
Width = 735
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 4200
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 3375
Left = 0
TabIndex = 0
Top = 720
Width = 7335
_ExtentX = 12938
_ExtentY = 5953
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc AdoDepName
Height = 375
Left = 4320
Top = 120
Visible = 0 'False
Width = 2055
_ExtentX = 3625
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "AdoDepName"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataListLib.DataCombo dco_DepName
Height = 330
Left = 1200
TabIndex = 3
Top = 195
Width = 1935
_ExtentX = 3413
_ExtentY = 556
_Version = 393216
Style = 2
Text = ""
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "选择部门"
Height = 180
Left = 240
TabIndex = 2
Top = 277
Width = 720
End
End
Attribute VB_Name = "FrmEmpMan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Refresh_Employees()
Dim TmpSource As String
TmpSource = "SELECT EmpId AS 员工编号,EmpName as 员工姓名,Sex AS 性别," _
+ "DepName as 部门名称,ETitle AS 职务名称 " _
+ "FROM Employees "
If Check1.Value = 0 And Len(Trim(dco_DepName.Text)) <> 0 Then
TmpSource = TmpSource + " Where DepName='" + Trim(dco_DepName.Text) + "' ORDER BY EmpId"
Else
TmpSource = TmpSource + " ORDER BY EmpId"
End If
'设置数据源属性
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = TmpSource
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
'设置列宽度
DataGrid1.Columns(0).Width = 1000
DataGrid1.Columns(1).Width = 1600
DataGrid1.Columns(2).Width = 1000
DataGrid1.Columns(3).Width = 1600
DataGrid1.Columns(4).Width = 1600
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
dco_DepName.Enabled = False
Else
dco_DepName.Enabled = True
End If
Refresh_Employees
End Sub
Private Sub Cmd_Add_Click()
'设置添加信息
FrmEmpEdit.Modify = False
FrmEmpEdit.txtName = ""
FrmEmpEdit.cmb_Sex.ListIndex = 0
FrmEmpEdit.dco_DepName.Text = ""
FrmEmpEdit.dco_Title.Text = ""
FrmEmpEdit.Show 1
Refresh_Employees
End Sub
Private Sub Cmd_Back_Click()
Unload Me
End Sub
Private Sub Cmd_Del_Click()
If Adodc1.Recordset.BOF = True Then
MsgBox "请选择记录"
Exit Sub
End If
'是否存在此员工的销售机会
If MyChance.HaveCustomer(Adodc1.Recordset.Fields(0)) = True Then
MsgBox "销售机会中存在此员工信息,不能删除!"
Exit Sub
End If
'确认删除
If MsgBox("是否确定要删除员工信息", vbYesNo, "请确认") = vbNo Then
Exit Sub
End If
'删除员工信息
Call MyEmp.Delete(Adodc1.Recordset.Fields(0))
MsgBox "删除成功"
Refresh_Employees
End Sub
Private Sub Cmd_Modi_Click()
Dim TmpAreaId As Long
If Adodc1.Recordset.BOF = True Then
MsgBox "请选择记录"
Exit Sub
End If
'员工姓名
FrmEmpEdit.OriEmpId = Adodc1.Recordset.Fields(0)
FrmEmpEdit.txtName = Trim(Adodc1.Recordset.Fields(1))
'性别
If Trim(Adodc1.Recordset.Fields(2)) = "男" Then
FrmEmpEdit.cmb_Sex.ListIndex = 0
Else
FrmEmpEdit.cmb_Sex.ListIndex = 1
End If
'部门
FrmEmpEdit.dco_DepName.Text = Trim(Adodc1.Recordset.Fields(3))
'职务
FrmEmpEdit.dco_Title.Text = Trim(Adodc1.Recordset.Fields(4))
FrmEmpEdit.Modify = True
FrmEmpEdit.Show 1
'刷新数据
Refresh_Employees
End Sub
Private Sub dco_DepName_Click(Area As Integer)
Refresh_Employees
End Sub
Private Sub Form_Load()
'装入部门名称
AdoDepName.ConnectionString = Conn
AdoDepName.RecordSource = "SELECT Distinct DepName FROM Employees Order By DepName"
AdoDepName.Refresh
Set dco_DepName.RowSource = AdoDepName
dco_DepName.ListField = "DepName"
dco_DepName.BoundColumn = "DepName"
dco_DepName.Enabled = False
Check1.Value = 1
Refresh_Employees
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -