📄 addscore.frm
字号:
VERSION 5.00
Begin VB.Form AddScore
BackColor = &H8000000A&
Caption = "添加学生成绩"
ClientHeight = 4110
ClientLeft = 60
ClientTop = 345
ClientWidth = 5295
LinkTopic = "Form1"
ScaleHeight = 4110
ScaleWidth = 5295
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 375
Left = 840
TabIndex = 0
Top = 120
Width = 1335
End
Begin VB.TextBox Text2
Height = 375
Left = 3240
TabIndex = 1
Top = 120
Width = 975
End
Begin VB.TextBox Text3
Height = 375
Left = 1200
TabIndex = 2
Top = 660
Width = 855
End
Begin VB.TextBox Text4
Height = 375
Left = 3240
TabIndex = 3
Top = 660
Width = 975
End
Begin VB.TextBox Text5
Height = 375
Left = 1200
TabIndex = 4
Top = 1200
Width = 855
End
Begin VB.TextBox Text6
Height = 375
Left = 3240
TabIndex = 5
Top = 1200
Width = 975
End
Begin VB.TextBox Text7
Height = 375
Left = 1200
TabIndex = 6
Top = 1740
Width = 855
End
Begin VB.TextBox Text8
Height = 375
Left = 3240
TabIndex = 7
Top = 1740
Width = 975
End
Begin VB.TextBox Text9
Height = 375
Left = 1200
TabIndex = 8
Top = 2280
Width = 855
End
Begin VB.TextBox Text10
Height = 375
Left = 3240
TabIndex = 9
Top = 2280
Width = 975
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 495
Left = 3480
TabIndex = 11
Top = 3480
Width = 855
End
Begin VB.CommandButton Command1
Caption = "确认"
Default = -1 'True
Height = 495
Left = 2040
TabIndex = 10
Top = 3480
Width = 855
End
Begin VB.Data Data1
Connect = "Access"
DatabaseName = "studentInformation.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 120
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "学生成绩"
Top = 3000
Visible = 0 'False
Width = 4095
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "学号"
Height = 375
Left = 360
TabIndex = 21
Top = 120
Width = 495
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "姓名"
Height = 375
Left = 2400
TabIndex = 20
Top = 120
Width = 495
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "英语"
Height = 375
Left = 360
TabIndex = 19
Top = 720
Width = 495
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "ASP"
Height = 375
Left = 360
TabIndex = 18
Top = 2280
Width = 495
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "VB"
Height = 375
Left = 2400
TabIndex = 17
Top = 2280
Width = 495
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "微机原理"
Height = 495
Left = 240
TabIndex = 16
Top = 1200
Width = 975
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "操作系统"
Height = 495
Left = 2280
TabIndex = 15
Top = 1200
Width = 975
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "局域网技术"
Height = 495
Left = 240
TabIndex = 14
Top = 1800
Width = 975
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "市场营销"
Height = 495
Left = 2280
TabIndex = 13
Top = 1800
Width = 975
End
Begin VB.Label Label10
BackStyle = 0 'Transparent
Caption = "体育"
Height = 375
Left = 2400
TabIndex = 12
Top = 720
Width = 495
End
End
Attribute VB_Name = "AddScore"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "" Then
Command1.Enabled = False
Text1.SetFocus
Else
Command1.Enabled = True
Data1.Recordset.AddNew
Data1.Recordset.Fields("学号") = Text1.Text
Data1.Recordset.Fields("姓名") = Text2.Text
Data1.Recordset.Fields("英语") = Text3.Text
Data1.Recordset.Fields("体育") = Text4.Text
Data1.Recordset.Fields("微机原理") = Text5.Text
Data1.Recordset.Fields("操作系统") = Text6.Text
Data1.Recordset.Fields("局域网技术") = Text7.Text
Data1.Recordset.Fields("市场营销") = Text8.Text
Data1.Recordset.Fields("ASP") = Text9.Text
Data1.Recordset.Fields("VB") = Text10.Text
Data1.Recordset.Update
Data1.Recordset.MoveLast
Data1.Refresh
End If
Text1.Text = "": Text2.Text = "": Text3.Text = "": Text4.Text = ""
Text5.Text = "": Text6.Text = "": Text7.Text = "": Text8.Text = ""
Text9.Text = "": Text10.Text = ""
End Sub
Private Sub Command2_Click()
Me.Hide
End Sub
Private Sub Text1_LostFocus()
Data1.RecordSource = "Select*From 学生成绩 Where 学号 ='" & Text1.Text & "'"
Data1.Refresh
If Data1.Recordset.EOF Then
Text2.SetFocus
Else
MsgBox "已存在此学生的成绩!", vbOKOnly + vbExclamation, "提示"
Data1.RecordSource = "学生成绩"
Data1.Refresh
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -