?? frmencouragementedit.frm
字號(hào):
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmEncouragementEdit
BorderStyle = 3 'Fixed Dialog
Caption = "獎(jiǎng)懲信息編輯"
ClientHeight = 3255
ClientLeft = 45
ClientTop = 330
ClientWidth = 5085
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3255
ScaleWidth = 5085
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "返回(&R)"
Height = 405
Left = 3870
TabIndex = 4
Top = 2640
Width = 1125
End
Begin VB.CommandButton Command1
Caption = "保存(&S)"
Height = 405
Left = 2670
TabIndex = 3
Top = 2640
Width = 1125
End
Begin VB.Frame Frame1
Height = 2505
Left = 60
TabIndex = 5
Top = 0
Width = 4935
Begin VB.TextBox Text3
Height = 345
Left = 840
TabIndex = 2
Top = 2040
Width = 3945
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 345
Left = 840
TabIndex = 1
Top = 1584
Width = 1905
_ExtentX = 3360
_ExtentY = 609
_Version = 393216
Format = 19791873
CurrentDate = 38086
End
Begin VB.ComboBox Combo1
Height = 330
ItemData = "frmEncouragementEdit.frx":0000
Left = 840
List = "frmEncouragementEdit.frx":000A
Style = 2 'Dropdown List
TabIndex = 0
Top = 1146
Width = 1905
End
Begin VB.TextBox Text2
Height = 345
Left = 840
Locked = -1 'True
TabIndex = 9
TabStop = 0 'False
Top = 693
Width = 1905
End
Begin VB.TextBox Text1
Height = 345
Left = 840
Locked = -1 'True
TabIndex = 7
TabStop = 0 'False
Top = 240
Width = 1905
End
Begin VB.Label Label5
Caption = "內(nèi)容:"
Height = 210
Left = 120
TabIndex = 12
Top = 2100
Width = 525
End
Begin VB.Label Label4
Caption = "日期:"
Height = 345
Left = 120
TabIndex = 11
Top = 1650
Width = 555
End
Begin VB.Label Label3
Caption = "類別:"
Height = 210
Left = 120
TabIndex = 10
Top = 1200
Width = 525
End
Begin VB.Label Label2
Caption = "姓名:"
Height = 210
Left = 120
TabIndex = 8
Top = 750
Width = 525
End
Begin VB.Label Label1
Caption = "學(xué)籍號(hào):"
Height = 210
Left = 120
TabIndex = 6
Top = 300
Width = 735
End
End
End
Attribute VB_Name = "frmEncouragementEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
''============================模塊說(shuō)明=================================
''名稱:
''功能:
''作者:
''日期:
''備注:
''版本 修改日期 修改人 原因
''====================================================================
Option Explicit
Private mlngID As Long
Private mblnEdit As Boolean
Public Sub EditEncouragement(Optional ByVal lngID As Long = 0, Optional ByVal strStudentNumber As String, Optional ByVal strStudentName As String)
Dim rst As Recordset
mlngID = lngID
mblnEdit = (lngID <> 0)
Me.Combo1.ListIndex = 0
If mblnEdit Then
Set rst = New Recordset
rst.ActiveConnection = pCN
rst.CursorLocation = adUseClient
rst.LockType = adLockBatchOptimistic
rst.CursorType = adOpenStatic
rst.Source = "select * from 獎(jiǎng)懲記錄 where ID=" & lngID
rst.Open
Text1.Text = rst![學(xué)籍號(hào)]
Text2.Text = rst![學(xué)生姓名]
Combo1.ListIndex = IIf(rst![類型] = "獎(jiǎng)勵(lì)", 0, 1)
DTPicker1.Value = rst![日期]
Text3.Text = rst![內(nèi)容] & ""
Else
Text2.Text = strStudentName
Text1.Text = strStudentNumber
End If
Me.Show 1
End Sub
Private Sub Command1_Click()
Dim rst As Recordset
On Error GoTo Proc_Exit
If Len(Text1) = 0 Then
MsgBox "學(xué)籍號(hào)不能為空!", vbInformation
GoTo Proc_Exit
End If
If Len(Text2) = 0 Then
MsgBox "學(xué)生姓名不能為空!", vbInformation
GoTo Proc_Exit
End If
Set rst = New Recordset
rst.ActiveConnection = pCN
rst.CursorLocation = adUseClient
rst.LockType = adLockBatchOptimistic
rst.CursorType = adOpenStatic
If mblnEdit Then
rst.Source = "select * from 獎(jiǎng)懲記錄 where ID=" & mlngID
rst.Open
Else
rst.Source = "select * from 獎(jiǎng)懲記錄"
rst.Open
rst.AddNew
End If
rst![學(xué)籍號(hào)] = Text1.Text
rst![學(xué)生姓名] = Text2.Text
rst![類型] = Combo1.Text
rst![日期] = DTPicker1.Value
rst![內(nèi)容] = Text3.Text
rst.UpdateBatch
mblnEdit = False
Text3.Text = ""
Combo1.SetFocus
Proc_Exit:
If Err.Number <> 0 Then
If Err.Number = -2147467259 Then
MsgBox "學(xué)籍號(hào)不能重復(fù)!", vbInformation
Else
MsgBox "發(fā)生意外錯(cuò)誤,錯(cuò)誤號(hào):" & Err.Number & " 錯(cuò)誤描述:" & Err.Description, vbInformation
End If
Err.Clear
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -