📄 frmempedit.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmEmpEdit
BorderStyle = 1 'Fixed Single
Caption = "销售人员信息编辑"
ClientHeight = 2190
ClientLeft = 45
ClientTop = 330
ClientWidth = 6405
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2190
ScaleWidth = 6405
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 1215
Left = 240
TabIndex = 3
Top = 120
Width = 5895
Begin VB.ComboBox cmb_Sex
Height = 300
Left = 3960
Style = 2 'Dropdown List
TabIndex = 10
Top = 180
Width = 1335
End
Begin MSDataListLib.DataCombo dco_DepName
Height = 330
Left = 1200
TabIndex = 8
Top = 645
Width = 1455
_ExtentX = 2566
_ExtentY = 582
_Version = 393216
Text = ""
End
Begin VB.TextBox txtName
Height = 270
Left = 1200
MaxLength = 100
TabIndex = 0
Top = 195
Width = 1455
End
Begin MSDataListLib.DataCombo dco_Title
Height = 330
Left = 3960
TabIndex = 9
Top = 660
Width = 1455
_ExtentX = 2566
_ExtentY = 582
_Version = 393216
Text = ""
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "性别"
Height = 180
Left = 3360
TabIndex = 7
Top = 240
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "职务名称"
Height = 180
Left = 3000
TabIndex = 6
Top = 720
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "所属部门"
Height = 180
Left = 120
TabIndex = 5
Top = 720
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "员工姓名"
Height = 180
Left = 120
TabIndex = 4
Top = 240
Width = 720
End
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Default = -1 'True
Height = 400
Left = 1410
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 1
Top = 1560
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 3600
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 1560
Width = 1300
End
Begin MSAdodcLib.Adodc AdoDepName
Height = 375
Left = 0
Top = 1440
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_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 MSAdodcLib.Adodc AdoTitle
Height = 375
Left = 4440
Top = 1440
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_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 = "AdoTitle"
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
End
Attribute VB_Name = "FrmEmpEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriEmpId As Long '员工编号
Private Function Check() As Boolean
If Trim(txtName) = "" Then
MsgBox "请输入员工名称"
txtName.SetFocus
txtName.SelStart = 0
txtName.SelLength = Lench(Trim(txtName))
Check = False
Exit Function
End If
If Len(Trim(dco_DepName.Text)) = 0 Then
MsgBox "请选择部门名称"
dco_DepName.SetFocus
Check = False
Exit Function
End If
If Len(Trim(dco_Title.Text)) = 0 Then
MsgBox "请选择职务名称"
dco_Title.SetFocus
Check = False
Exit Function
End If
Check = True
End Function
Private Sub Cmd_OK_Click()
If Check = False Then
Exit Sub
End If
'保存员工信息
With MyEmp
.EmpName = MakeStr(txtName)
.Sex = MakeStr(cmb_Sex.Text)
.DepName = MakeStr(dco_DepName.Text)
.ETitle = MakeStr(dco_Title.Text)
If Modify = False Then
.Insert
Else
.Update (OriEmpId)
End If
End With
MsgBox "编辑成功"
Unload Me
End Sub
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Form_Load()
DataLoad '装入部门名称和职务名称
End Sub
Private Sub DataLoad()
'载入性别信息
cmb_Sex.AddItem "男", 0
cmb_Sex.AddItem "女", 1
'读取部门名称数据
AdoDepName.ConnectionString = Conn
AdoDepName.RecordSource = "SELECT Distinct DepName FROM Employees Order By DepName"
AdoDepName.Refresh
Set dco_DepName.RowSource = AdoDepName
dco_DepName.ListField = "DepName"
'读取职务名称数据
AdoTitle.ConnectionString = Conn
AdoTitle.RecordSource = "SELECT Distinct ETitle FROM Employees Order By ETitle"
AdoTitle.Refresh
Set dco_Title.RowSource = AdoTitle
dco_Title.ListField = "ETitle"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -