?? f_zhenggangxvqiu.frm
字號:
TabIndex = 4
Top = 6000
Width = 5895
Begin VB.CommandButton cmdAdd
Caption = "增加"
Height = 300
Left = 120
TabIndex = 11
Top = 0
Width = 975
End
Begin VB.CommandButton cmdEdit
Caption = "編輯"
Height = 300
Left = 1200
TabIndex = 10
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdDelete
Caption = "刪除"
Height = 300
Left = 2400
TabIndex = 9
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdRefresh
Caption = "刷新"
Height = 300
Left = 3600
TabIndex = 8
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdClose
Caption = "關閉"
Height = 300
Left = 4800
TabIndex = 7
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdUpdate
Caption = "保存"
Height = 300
Left = 3600
TabIndex = 6
Top = 0
Visible = 0 'False
Width = 1095
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 300
Left = 4800
TabIndex = 5
Top = 0
Visible = 0 'False
Width = 1095
End
End
Begin VB.Frame Frame3
Height = 5655
Left = -74760
TabIndex = 2
Top = 480
Width = 8775
Begin MSDataGridLib.DataGrid DataGrid1
Height = 5175
Left = 240
TabIndex = 3
Top = 240
Width = 8295
_ExtentX = 14631
_ExtentY = 9128
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 14
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
End
End
End
Attribute VB_Name = "F_ZhengGangXVQiu"
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 WithEvents RsBuMen As Recordset
Attribute RsBuMen.VB_VarHelpID = -1
Dim mbChangedByCode As Boolean
Dim mvBookMark As Variant
Dim mbEditFlag As Boolean
Dim mbAddNewFlag As Boolean
Dim mbDataChanged As Boolean
Private Sub Form_Load()
On Error Resume Next
For Each TextBox In Me.Controls
TextBox.Font.Name = "宋體"
TextBox.Font.Size = 9
Next
Dim SqlBuMen As String
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select * from 增崗需求單", db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = adoPrimaryRS
SetButtons True
Set DTPicker2.DataSource = adoPrimaryRS
Set DTPicker3.DataSource = adoPrimaryRS
Set DTPicker4.DataSource = adoPrimaryRS
Set Combo1.DataSource = adoPrimaryRS
Dim oText As TextBox
'Bind the text boxes to the data provider
For Each oText In Me.txtFields
Set oText.DataSource = adoPrimaryRS
Next
SqlBuMen = "select distinct 部門名稱 from 部門維護表"
Set RsBuMen = db.Execute(SqlBuMen)
While Not RsBuMen.EOF
Combo1.AddItem Trim(RsBuMen("部門名稱"))
RsBuMen.MoveNext
Wend
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)
cmdAdd.Visible = bVal
cmdEdit.Visible = bVal
cmdUpdate.Visible = Not bVal
cmdCancel.Visible = Not bVal
cmdDelete.Visible = bVal
cmdClose.Visible = bVal
cmdRefresh.Visible = bVal
If bVal Then
Set DataGrid1.DataSource = adoPrimaryRS
Else
Set DataGrid1.DataSource = Nothing
End If
Dim oText As TextBox
'Bind the text boxes to the data provider
For Each oText In Me.txtFields
oText.Enabled = Not bVal
Next
DTPicker2.Enabled = Not bVal
DTPicker3.Enabled = Not bVal
DTPicker4.Enabled = Not bVal
End Sub
Private Sub txtFields_Change(Index As Integer)
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
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -