📄 frm_addalter.frm
字号:
Width = 915
End
Begin VB.Label Label2
Caption = "新部门名称"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Index = 4
Left = 720
TabIndex = 11
Top = 1980
Width = 1065
End
Begin VB.Label Label2
Caption = "原 职 务"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Index = 3
Left = 3720
TabIndex = 9
Top = 1500
Width = 915
End
Begin VB.Label Label2
Caption = "原部门名称"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Index = 2
Left = 720
TabIndex = 7
Top = 1500
Width = 1065
End
Begin VB.Label Label2
Caption = "职工姓名"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Index = 1
Left = 3720
TabIndex = 5
Top = 1050
Width = 915
End
Begin VB.Label Label2
Caption = "职工编号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Index = 0
Left = 930
TabIndex = 3
Top = 1020
Width = 915
End
Begin VB.Label Label1
Caption = "添加职工的调动信息"
BeginProperty Font
Name = "隶书"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1950
TabIndex = 1
Top = 270
Width = 3405
End
End
End
Attribute VB_Name = "Frm_AddAlter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
''''''进行存盘操作'''''''''''''''''
Dim m_Rs As New ADODB.Recordset
Dim strSql As String
''''''iAFlag=0代表是增加记录'''''''''''''''''
If iAFlag = 0 Then
If MsgBox("确定是否存盘?", vbYesNo + vbQuestion, "存盘?") = vbYes Then
'''''进行输入正确性的检测'''''''''''''
If Combo1.Text = "" Then
MsgBox "请选择职工编号..."
Exit Sub
End If
If Combo2.Text = "" Then
MsgBox "请选择职工的原来部门名称..."
Exit Sub
End If
'''''''''''''''''''''''''''''''''''''
strSql = "INSERT INTO AlterationInfo(AID,AName,AOldDept,AOldPosition,ANewDept,ANewPosition,AOutTime,AInTime,"
strSql = strSql & "AOutReason,ADirection,ARemark) VALUES('" & Trim(Combo1.Text) & "','" & Trim(Text1.Text) & "','"
strSql = strSql & Trim(Combo2.Text) & "','" & Trim(Combo3.Text) & "','" & Trim(Combo4.Text) & "','" & Trim(Combo5.Text)
strSql = strSql & "','" & Trim(OutDate.Text) & "','" & Trim(InDate.Text) & "','" & Trim(Text2.Text) & "','" & Trim(Text3.Text)
strSql = strSql & "','" & Trim(Text4.Text) & "')"
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "存盘成功..."
'''''''初始化各个文本控件''''''''''''''''''''''''''
With Me
Combo1.Text = ""
Text1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End With
End If
End If
'''''''iAFlag=1代表是修改记录''''''''''''''''''''''''''''
If iAFlag = 1 Then
If MsgBox("确定是否修改记录?", vbYesNo + vbQuestion, "修改?") = vbYes Then
strSql = "UPDATE AlterationInfo Set AName='" & Trim(Text1.Text) & "',AOldDept='" & Trim(Combo2.Text) & "',AOldPosition='" & Trim(Combo3.Text) & "',ANewDept='" & Trim(Combo4.Text) & "',ANewPosition='"
strSql = strSql & Trim(Combo5.Text) & "',AOutTime='" & Trim(OutDate.Text) & "',AInTime='" & Trim(InDate.Text) & "',AOutReason='" & Trim(Text2.Text) & "',ADirection='" & Trim(Text3.Text) & "',ARemark='"
strSql = strSql & Trim(Text4.Text) & "' WHERE AID='" & Trim(sAData(0)) & "'"
''''MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "修改成功..."
End If
End If
If iAFlag = 2 Then
If MsgBox("确定是否删除此记录?", vbYesNo + vbQuestion, "删除?") = vbYes Then
strSql = "DELETE * FROM AlterationInfo WHERE AID='" & Trim(Combo1.Text) & "'"
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "删除成功..."
With Me
Combo1.Text = ""
Text1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End With
End If
End If
End Sub
Private Sub Combo1_Click()
Dim strSql As String
strSql = "SELECT * FROM StuffInfo"
Text1.Text = getFieldValue(strSql, "Person.mdb", "SID", "SName", Trim(Combo1.Text))
End Sub
Private Sub Combo2_Click()
Dim strSql As String
strSql = "SELECT * FROM StuffInfo"
Combo3.Text = getFieldValue(strSql, "Person.mdb", "SDept", "SPosition", Trim(Combo2.Text))
End Sub
Private Sub Combo4_Click()
Dim strSql As String
strSql = "SELECT * FROM StuffInfo"
Combo5.Text = getFieldValue(strSql, "Person.mdb", "SDept", "SPosition", Trim(Combo4.Text))
End Sub
Private Sub Form_Load()
'''''''''
Dim strSql As String
''''**SID为职工编号的字段名'''''''
''''**SDept为职工所在的部门名称字段名'''''''''
''''**StuffInfo为人事基本信息的表名'''''''''''
''''**Person.mdb为数据库名称''''''''''''''''''
''''**BindToCombo为公共模块的函数在模块AdoConn中
strSql = "SELECT * FROM StuffInfo Order By SID"
BindToCombo strSql, "Person.mdb", "SID", Combo1 '''''将人事基本信息的职工编号添加到控件combo1中
strSql = "SELECT DISTINCT SDept From StuffInfo"
BindToCombo strSql, "Person.mdb", "SDept", Combo2 '''''将人事基本信息的部门名称添加到控件combo1中
BindToCombo strSql, "Person.mdb", "SDept", Combo4 '''''将人事基本信息的部门名称添加到控件combo4中
''''''添加日期''''''''''''''
'''''iAFlag=0代表是添加记录'''''''''''''''''
If iAFlag = 0 Then
OutDate.Text = Format(Now, "yyyy年mm月dd日") ''''格式化显示日期
InDate.Text = Format(Now, "yyyy年mm月dd日") ''''格式化显示日期
With Me
Combo1.Text = ""
Text1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End With
End If
''''''iAFlag=1代表是修改记录''''''''''''''''''''''
If iAFlag = 1 Then
With Me
Combo1.Text = Trim(sAData(0))
Text1.Text = Trim(sAData(1))
Combo2.Text = Trim(sAData(2))
Combo3.Text = Trim(sAData(3))
Combo4.Text = Trim(sAData(4))
Combo5.Text = Trim(sAData(5))
OutDate.Text = Trim(sAData(6))
InDate.Text = Trim(sAData(7))
Text2.Text = Trim(sAData(8))
Text3.Text = Trim(sAData(9))
Text4.Text = Trim(sAData(10))
''Text2.Text = Trim(sAData(8))
End With
End If
''''''iAFlag=2代表是删除记录''''''''''''''''''''''
If iAFlag = 2 Then
With Me
Combo1.Text = Trim(sAData(0))
Text1.Text = Trim(sAData(1))
Combo2.Text = Trim(sAData(2))
Combo3.Text = Trim(sAData(3))
Combo4.Text = Trim(sAData(4))
Combo5.Text = Trim(sAData(5))
OutDate.Text = Trim(sAData(6))
InDate.Text = Trim(sAData(7))
Text2.Text = Trim(sAData(8))
Text3.Text = Trim(sAData(9))
Text4.Text = Trim(sAData(10))
''Text2.Text = Trim(sAData(8))
End With
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -