?? addeform.frm
字號:
VERSION 5.00
Begin VB.Form AddEForm
Caption = "添加員工"
ClientHeight = 5040
ClientLeft = 5820
ClientTop = 3630
ClientWidth = 4110
Icon = "AddEForm.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5040
ScaleWidth = 4110
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 2040
TabIndex = 13
Top = 4440
Width = 1095
End
Begin VB.CommandButton cmdAdd
Caption = "添加"
Height = 375
Left = 600
TabIndex = 12
Top = 4440
Width = 1215
End
Begin VB.TextBox txtValue
Height = 375
Index = 5
Left = 1448
TabIndex = 11
Top = 3620
Width = 2415
End
Begin VB.TextBox txtValue
Height = 375
Index = 4
Left = 1448
TabIndex = 9
Top = 2920
Width = 2415
End
Begin VB.TextBox txtValue
Height = 375
Index = 3
Left = 1448
TabIndex = 7
Top = 2220
Width = 2415
End
Begin VB.TextBox txtValue
Height = 375
Index = 2
Left = 1448
TabIndex = 5
Top = 1520
Width = 2415
End
Begin VB.TextBox txtValue
Height = 375
Index = 1
Left = 1448
TabIndex = 3
Top = 820
Width = 2415
End
Begin VB.TextBox txtValue
Height = 375
Index = 0
Left = 1448
TabIndex = 1
Top = 120
Width = 2415
End
Begin VB.Label lblField
Caption = "lblField"
Height = 375
Index = 5
Left = 248
TabIndex = 10
Top = 3640
Width = 855
End
Begin VB.Label lblField
Caption = "lblField"
Height = 375
Index = 4
Left = 248
TabIndex = 8
Top = 2960
Width = 855
End
Begin VB.Label lblField
Caption = "lblField"
Height = 375
Index = 3
Left = 248
TabIndex = 6
Top = 2280
Width = 855
End
Begin VB.Label lblField
Caption = "lblField"
Height = 375
Index = 2
Left = 248
TabIndex = 4
Top = 1600
Width = 855
End
Begin VB.Label lblField
Caption = "lblField"
Height = 375
Index = 1
Left = 248
TabIndex = 2
Top = 920
Width = 855
End
Begin VB.Label lblField
Caption = "lblField"
Height = 375
Index = 0
Left = 248
TabIndex = 0
Top = 240
Width = 855
End
End
Attribute VB_Name = "AddEForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'添加員工
Private Sub cmdAdd_Click()
'打開錯誤處理陷阱
Dim intErrFileNo As Integer '自由文件號
On Error GoTo ErrGoto
'----------------------------------------------------
'生成SQL語句
SQL = "INSERT INTO 職工(職工ID,職位,姓名,性別,出生年月,工作年月) VALUES("""
SQL = SQL & txtValue(0).Text & ""","""
SQL = SQL & txtValue(1).Text & ""","""
SQL = SQL & txtValue(2).Text & ""","""
SQL = SQL & txtValue(3).Text & """,#"
SQL = SQL & txtValue(4).Text & "#,#"
SQL = SQL & txtValue(5).Text & "#)"
'打開連接
OpenDBFile
'執(zhí)行SQL語句
gCon.Execute SQL
'關(guān)閉連接
CloseDBFile
'刷新數(shù)據(jù)
HRForm.Adodc1.Refresh
'隱藏窗體
Me.Hide
'----------------------------------------------------
Exit Sub
'-----------------------------
ErrGoto:
'把錯誤信息保存在文件里
intErrFileNo = FreeFile()
Open "YFSystem.ini" For Append As intErrFileNo
Print #intErrFileNo, Chr(34) + Format(Now, "YYYY-MM-DD HH:MM:SS") + Chr(34), Chr(34) + "信息" + Chr(34), Chr(34) + Err.Description + Chr(34), Chr(34) + "cmdAdd_Click(AddEForm)" + Chr(34), Chr(34) + App.Title + Chr(34)
Close #intErrFileNo
End Sub
Private Sub cmdCancel_Click()
Me.Hide
End Sub
'初始化
Private Sub Form_activate()
lblField(0).Caption = "職工ID"
lblField(1).Caption = "職位"
lblField(2).Caption = "姓名"
lblField(3).Caption = "性別"
lblField(4).Caption = "出生年月"
lblField(5).Caption = "工作年月"
For i = 0 To 5
txtValue(i) = ""
Next
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -