📄 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 + -