?? f_fulifeiyong.frm
字號:
End
Begin VB.TextBox txtFields
DataField = "月份"
Height = 285
Index = 1
Left = 4680
TabIndex = 6
Top = 240
Width = 1935
End
Begin VB.TextBox txtFields
DataField = "年度"
Height = 285
Index = 0
Left = 1080
TabIndex = 4
Top = 240
Width = 1935
End
Begin VB.Label lblLabels
Caption = "用工類型:"
Height = 255
Index = 10
Left = 3480
TabIndex = 34
Top = 2040
Width = 855
End
Begin VB.Label lblLabels
Caption = "費用金額:"
Height = 255
Index = 9
Left = 240
TabIndex = 20
Top = 3240
Width = 855
End
Begin VB.Label lblLabels
Caption = "費用項目:"
Height = 255
Index = 8
Left = 3480
TabIndex = 18
Top = 2640
Width = 855
End
Begin VB.Label lblLabels
Caption = "費用類型:"
Height = 255
Index = 7
Left = 240
TabIndex = 16
Top = 2640
Width = 855
End
Begin VB.Label lblLabels
Caption = "時間:"
Height = 255
Index = 6
Left = 240
TabIndex = 15
Top = 840
Width = 615
End
Begin VB.Label lblLabels
Caption = "姓名:"
Height = 255
Index = 5
Left = 240
TabIndex = 13
Top = 1440
Width = 615
End
Begin VB.Label lblLabels
Caption = "員工號:"
Height = 255
Index = 4
Left = 3480
TabIndex = 11
Top = 840
Width = 855
End
Begin VB.Label lblLabels
Caption = "崗位:"
Height = 255
Index = 3
Left = 240
TabIndex = 9
Top = 2040
Width = 495
End
Begin VB.Label lblLabels
Caption = "部門:"
Height = 255
Index = 2
Left = 3480
TabIndex = 7
Top = 1440
Width = 855
End
Begin VB.Label lblLabels
Caption = "月份:"
Height = 255
Index = 1
Left = 3480
TabIndex = 5
Top = 240
Width = 855
End
Begin VB.Label lblLabels
Caption = "年度:"
Height = 255
Index = 0
Left = 240
TabIndex = 3
Top = 300
Width = 855
End
End
End
End
End
Attribute VB_Name = "F_FuLiFeiYong"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim WithEvents adoPrimaryRS As Recordset
Attribute adoPrimaryRS.VB_VarHelpID = -1
Dim mvBookMark As Variant
Dim mbEditFlag As Boolean
Dim mbAddNewFlag As Boolean
Private Sub Form_Load()
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select * from 福利費用", db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = adoPrimaryRS
Set DTPicker1.DataSource = adoPrimaryRS
SetButtons True
Dim oText As TextBox
'Bind the text boxes to the data provider
For Each oText In Me.txtFields
Set oText.DataSource = adoPrimaryRS
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub
Private Sub cmdAdd_Click()
On Error GoTo AddErr
With adoPrimaryRS
If Not (.BOF And .EOF) Then
mvBookMark = .Bookmark
End If
.AddNew
mbAddNewFlag = True
SetButtons False
End With
Exit Sub
AddErr:
MsgBox "增加操作有錯誤", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdDelete_Click()
On Error GoTo DeleteErr
With adoPrimaryRS
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
Exit Sub
DeleteErr:
MsgBox "刪除操作有錯誤", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdRefresh_Click()
'This is only needed for multi user apps
On Error GoTo RefreshErr
adoPrimaryRS.Requery
Exit Sub
RefreshErr:
MsgBox "刷新操作有錯誤", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdEdit_Click()
On Error GoTo EditErr
mbEditFlag = True
SetButtons False
Exit Sub
EditErr:
MsgBox "更改操作有錯誤", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdCancel_Click()
' On Error Resume Next
On Error GoTo CancelErr
mbEditFlag = False
mbAddNewFlag = False
adoPrimaryRS.CancelUpdate
If mvBookMark > 0 Then
adoPrimaryRS.Bookmark = mvBookMark
Else
adoPrimaryRS.MoveFirst
End If
SetButtons True
Exit Sub
CancelErr:
MsgBox "取消操作有錯誤", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdUpdate_Click()
On Error GoTo UpdateErr
adoPrimaryRS.UpdateBatch adAffectAll
If mbAddNewFlag Then
adoPrimaryRS.MoveLast 'move to the new record
End If
mbEditFlag = False
mbAddNewFlag = False
SetButtons True
Exit Sub
UpdateErr:
MsgBox "保存操作有錯誤", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdClose_Click()
RSGL.Enabled = True
Unload Me
End Sub
Private Sub SetButtons(bVal As Boolean)
Dim oText As TextBox
cmdAdd.Visible = bVal
cmdEdit.Visible = bVal
cmdUpdate.Visible = Not bVal
cmdCancel.Visible = Not bVal
cmdDelete.Visible = bVal
cmdClose.Visible = bVal
cmdRefresh.Visible = bVal
For Each oText In Me.txtFields
oText.Enabled = Not bVal
Next
DTPicker1.Enabled = Not bVal
If bVal Then
Set DataGrid1.DataSource = adoPrimaryRS
Else
Set DataGrid1.DataSource = Nothing
End If
End Sub
Private Sub txtFields_LostFocus(Index As Integer)
If Index = 4 Then
Dim Sql3 As String
Sql3 = "select distinct 部門 ,姓名 ,崗位 ,用工類型 from 員工基本信息 where 員工號 = '" & txtFields(4).Text & "'"
Set rs3 = db.Execute(Sql3)
If Not rs3.EOF Then
If Not IsNull(rs3("姓名")) Then
txtFields(5).Text = Trim(rs3("姓名"))
End If
If Not IsNull(rs3("部門")) Then
txtFields(2).Text = Trim(rs3("部門"))
End If
If Not IsNull(rs3("崗位")) Then
txtFields(3).Text = Trim(rs3("崗位"))
End If
If Not IsNull(rs3("用工類型")) Then
txtFields(6).Text = Trim(rs3("用工類型"))
End If
End If
End If
If Not IsNumeric(txtFields(0).Text) And (txtFields(0).Text <> "") Then
MsgBox "請在“年度”中輸入數字", vbExclamation + vbOKOnly, pTitle
txtFields(0).SetFocus
txtFields(0).SelLength = Len(txtFields(0))
txtFields(0).SelStart = 0
End If
If Not IsNumeric(txtFields(1).Text) And (txtFields(1).Text <> "") Then
MsgBox "請在“月份”中輸入數字", vbExclamation + vbOKOnly, pTitle
txtFields(1).SetFocus
txtFields(1).SelLength = Len(txtFields(1))
txtFields(1).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 + -