?? form5.frm
字號:
VERSION 5.00
Begin VB.Form Form5
Caption = "添加記錄"
ClientHeight = 5100
ClientLeft = 3420
ClientTop = 3570
ClientWidth = 8565
LinkTopic = "Form5"
ScaleHeight = 5100
ScaleWidth = 8565
Begin VB.TextBox Text8
BeginProperty DataFormat
Type = 1
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 17
Top = 1080
Width = 1695
End
Begin VB.CommandButton 確定
Caption = "確定"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6480
TabIndex = 15
Top = 3480
Width = 1215
End
Begin VB.CommandButton 取消
Caption = "取消"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6480
TabIndex = 14
Top = 4320
Width = 1215
End
Begin VB.TextBox Text7
BeginProperty DataFormat
Type = 1
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6240
TabIndex = 6
Text = "0"
Top = 2400
Width = 1695
End
Begin VB.TextBox Text6
BeginProperty DataFormat
Type = 1
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6240
TabIndex = 5
Text = "0"
Top = 1680
Width = 1695
End
Begin VB.TextBox Text5
BeginProperty DataFormat
Type = 1
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6240
TabIndex = 4
Text = "0"
Top = 840
Width = 1695
End
Begin VB.TextBox Text4
BeginProperty DataFormat
Type = 1
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 3
Text = "0"
Top = 4080
Width = 1695
End
Begin VB.TextBox Text3
BeginProperty DataFormat
Type = 0
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 2
Text = "0"
Top = 3360
Width = 1695
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 1
Top = 2640
Width = 1695
End
Begin VB.TextBox Text1
BeginProperty DataFormat
Type = 1
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 0
Top = 1920
Width = 1695
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "班級:"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 600
TabIndex = 18
Top = 1200
Width = 990
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "輸入要添加的數據:"
BeginProperty Font
Name = "宋體"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Left = 600
TabIndex = 16
Top = 240
Width = 4860
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "計算機:"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 4680
TabIndex = 13
Top = 2520
Width = 1320
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "C語言:"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 4920
TabIndex = 12
Top = 1680
Width = 1170
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "物理:"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 4920
TabIndex = 11
Top = 960
Width = 990
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "英語:"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 600
TabIndex = 10
Top = 4200
Width = 990
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "高數:"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 600
TabIndex = 9
Top = 3480
Width = 990
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "姓名:"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 600
TabIndex = 8
Top = 2760
Width = 990
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "學號:"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 600
TabIndex = 7
Top = 2040
Width = 990
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Conn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Const ConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DATA.mdb;Persist Security Info=False"
Private Sub 取消_Click()
Visible = False
Form2.Visible = True
Unload Form5
End Sub
Private Sub 確定_Click()
If (Text3.Text < 0 Or Text3.Text > 100) Then
MsgBox "輸入有誤,請重新輸入"
Text3.SetFocus
GoTo chonglai
End If
If (Text4.Text < 0 Or Text4.Text > 100) Then
MsgBox "輸入有誤,請重新輸入"
Text4.SetFocus
GoTo chonglai
End If
If (Text5.Text < 0 Or Text5.Text > 100) Then
MsgBox "輸入有誤,請重新輸入"
Text5.SetFocus
GoTo chonglai
End If
If (Text6.Text < 0 Or Text6.Text > 100) Then
MsgBox "輸入有誤,請重新輸入"
Text6.SetFocus
GoTo chonglai
End If
If (Text7.Text < 0 Or Text7.Text > 100) Then
MsgBox "輸入有誤,請重新輸入"
Text7.SetFocus
GoTo chonglai
End If
Set Conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Conn.Open ConnStr
rs.Open "select * from 成績表", Conn, adOpenKeyset, adLockPessimistic
rs.AddNew
rs.Fields("班級") = Text8.Text
rs.Fields("學號") = Text1.Text
rs.Fields("姓名") = Text2.Text
rs.Fields("高數") = Text3.Text
rs.Fields("英語") = Text4.Text
rs.Fields("物理") = Text5.Text
rs.Fields("計算機") = Text7.Text
rs.Fields("C語言") = Text6.Text
rs.Update
rs.Close
Conn.Close
MsgBox "添加成功!"
chonglai:
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -