📄 frmaddtrain.frm
字号:
VERSION 5.00
Begin VB.Form frmAddTrain
BorderStyle = 1 'Fixed Single
Caption = "添加培训计划"
ClientHeight = 5040
ClientLeft = 45
ClientTop = 330
ClientWidth = 8145
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5040
ScaleWidth = 8145
Begin VB.Frame Frame1
Caption = "培训信息"
Height = 3735
Left = 120
TabIndex = 2
Top = 240
Width = 7815
Begin VB.TextBox txtFields
Height = 375
Index = 11
Left = 5640
TabIndex = 26
Top = 3120
Width = 1935
End
Begin VB.TextBox txtFields
Height = 375
Index = 10
Left = 1680
TabIndex = 25
Top = 3120
Width = 1935
End
Begin VB.TextBox txtFields
Height = 375
Index = 9
Left = 5640
TabIndex = 24
Top = 2592
Width = 1935
End
Begin VB.TextBox txtFields
Height = 375
Index = 8
Left = 1680
TabIndex = 23
Top = 2595
Width = 1935
End
Begin VB.TextBox txtFields
Height = 375
Index = 7
Left = 5640
TabIndex = 22
Top = 2064
Width = 1935
End
Begin VB.TextBox txtFields
Height = 375
Index = 6
Left = 1680
TabIndex = 21
Top = 2070
Width = 1935
End
Begin VB.TextBox txtFields
Height = 375
Index = 5
Left = 5640
TabIndex = 20
Top = 1536
Width = 1935
End
Begin VB.TextBox txtFields
Height = 375
Index = 4
Left = 1680
TabIndex = 19
Top = 1530
Width = 1935
End
Begin VB.TextBox txtFields
Height = 375
Index = 3
Left = 5640
TabIndex = 18
Top = 1008
Width = 1935
End
Begin VB.TextBox txtFields
Height = 375
Index = 2
Left = 1680
TabIndex = 17
Top = 1005
Width = 1935
End
Begin VB.TextBox txtFields
Height = 375
Index = 1
Left = 5640
TabIndex = 16
Top = 480
Width = 1935
End
Begin VB.TextBox txtFields
Height = 375
Index = 0
Left = 1680
TabIndex = 15
Top = 480
Width = 1935
End
Begin VB.Label Label12
Caption = "部门申请人:"
Height = 375
Left = 4200
TabIndex = 14
Top = 3240
Width = 1215
End
Begin VB.Label Label11
Caption = "培训内容:"
Height = 255
Left = 360
TabIndex = 13
Top = 3240
Width = 975
End
Begin VB.Label Label10
Caption = "预算费用:"
Height = 375
Left = 4200
TabIndex = 12
Top = 2688
Width = 1215
End
Begin VB.Label Label9
Caption = "培训目的:"
Height = 255
Left = 360
TabIndex = 11
Top = 2688
Width = 1215
End
Begin VB.Label Label8
Caption = "师资来源:"
Height = 375
Left = 4200
TabIndex = 10
Top = 2136
Width = 1695
End
Begin VB.Label Label7
Caption = "培训时数:"
Height = 255
Left = 360
TabIndex = 9
Top = 2136
Width = 1335
End
Begin VB.Label Label6
Caption = "地点:"
Height = 375
Left = 4200
TabIndex = 8
Top = 1584
Width = 855
End
Begin VB.Label Label5
Caption = "举办日期:"
Height = 255
Left = 360
TabIndex = 7
Top = 1584
Width = 975
End
Begin VB.Label Label4
Caption = "参加人数:"
Height = 375
Left = 4200
TabIndex = 6
Top = 1032
Width = 975
End
Begin VB.Label Label3
Caption = "培训对象:"
Height = 255
Left = 360
TabIndex = 5
Top = 1032
Width = 975
End
Begin VB.Label Label2
Caption = "培训种类:"
Height = 375
Left = 4200
TabIndex = 4
Top = 480
Width = 975
End
Begin VB.Label Label1
Caption = "培训名称:"
Height = 255
Left = 360
TabIndex = 3
Top = 480
Width = 1095
End
End
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 495
Left = 5040
TabIndex = 1
Top = 4200
Width = 1215
End
Begin VB.CommandButton cmdSave
Caption = "保存"
Height = 495
Left = 1680
TabIndex = 0
Top = 4200
Width = 1335
End
End
Attribute VB_Name = "frmAddTrain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdSave_Click()
Dim adoshowrsJL As ADODB.Recordset
Dim msgstr As String
If Not IsDate(txtFields(4).Text) Then
MsgBox "请在“举办日期”中输入数字", vbExclamation + vbOKOnly, pTitle
txtFields(4).SetFocus
txtFields(4).SelLength = Len(txtFields(4))
txtFields(4).SelStart = 0
Exit Sub
End If
If txtFields(0).Text <> "" Then
SqlJL = "SELECT * From 培训计划表 Where 培训名称 ='" & txtFields(0).Text & "' "
Else
MsgBox "请输入培训名称!", vbExclamation + vbOKOnly, "信息框"
Exit Sub
End If
Set adoshowrsJL = ExecuteSQL(SqlJL, msgstr)
If Not adoshowrsJL.BOF And Not adoshowrsJL.EOF Then
MsgBox "此培训名称已存在,请输入新的培训名称!", vbExclamation + vbOKOnly, "信息框"
Exit Sub
End If
Dim txtSQL As String
Dim mrcc As ADODB.Recordset
txtSQL = "select * from 培训计划表"
Set mrcc = ExecuteSQL(txtSQL, msgstr)
mrcc.AddNew
mrcc.Fields(1) = Val(txtFields(0).Text)
mrcc.Fields(2) = Val(txtFields(1).Text)
mrcc.Fields(3) = Trim(txtFields(2).Text)
mrcc.Fields(4) = Val(txtFields(3).Text)
mrcc.Fields(5) = CDate(txtFields(4).Text)
mrcc.Fields(6) = Trim(txtFields(5).Text)
mrcc.Fields(7) = Val(txtFields(6).Text)
mrcc.Fields(8) = Trim(txtFields(7).Text)
mrcc.Fields(9) = Trim(txtFields(8).Text)
mrcc.Fields(10) = Val(txtFields(9).Text)
mrcc.Fields(11) = Trim(txtFields(10).Text)
mrcc.Fields(12) = Trim(txtFields(11).Text)
mrcc.Update
MsgBox "培训计划信息添加成功!", vbOKOnly + vbExclamation, "添加培训计划信息"
mrcc.Close
End Sub
Private Sub txtFields_LostFocus(Index As Integer)
If Not IsNumeric(txtFields(3).Text) And (txtFields(3).Text <> "") Then
MsgBox "请在“参加人数”中输入数字", vbExclamation + vbOKOnly, pTitle
txtFields(3).SetFocus
txtFields(3).SelLength = Len(txtFields(3))
txtFields(3).SelStart = 0
End If
If Not IsNumeric(txtFields(6).Text) And (txtFields(6).Text <> "") Then
MsgBox "请在“培训时数”中输入数字", vbExclamation + vbOKOnly, pTitle
txtFields(6).SetFocus
txtFields(6).SelLength = Len(txtFields(6))
txtFields(6).SelStart = 0
End If
If Not IsNumeric(txtFields(9).Text) And (txtFields(9).Text <> "") Then
MsgBox "请在“预算费用”中输入数字", vbExclamation + vbOKOnly, pTitle
txtFields(9).SetFocus
txtFields(9).SelLength = Len(txtFields(9))
txtFields(9).SelStart = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -