📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "输入"
ClientHeight = 5445
ClientLeft = 60
ClientTop = 450
ClientWidth = 8745
LinkTopic = "Form2"
ScaleHeight = 5445
ScaleWidth = 8745
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
DataField = "成绩"
DataSource = "Data1"
Height = 495
Left = 2520
TabIndex = 8
Top = 2640
Width = 1815
End
Begin VB.TextBox Text2
DataField = "课程编码 "
DataSource = "Data1"
Height = 495
Left = 2520
TabIndex = 7
Top = 1680
Width = 1815
End
Begin VB.TextBox Text1
DataField = "学号"
DataSource = "Data1"
Height = 615
Left = 2520
TabIndex = 6
Top = 600
Width = 1815
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "I:\数据库.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 960
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "成绩表"
Top = 4800
Width = 6660
End
Begin VB.CommandButton Command3
Caption = "完成"
Height = 495
Left = 6240
TabIndex = 4
Top = 3840
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "修改"
Height = 495
Left = 3360
TabIndex = 3
Top = 3840
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 495
Left = 600
TabIndex = 2
Top = 3840
Width = 1215
End
Begin VB.Label Label3
Caption = "成绩"
Height = 495
Left = 840
TabIndex = 5
Top = 2520
Width = 1215
End
Begin VB.Label Label2
Caption = "课程编码"
Height = 495
Left = 720
TabIndex = 1
Top = 1560
Width = 1215
End
Begin VB.Label Label1
Caption = "学号"
Height = 495
Left = 840
TabIndex = 0
Top = 720
Width = 1215
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Command1.Caption = "添加" Then
Data1.Recordset.MoveLast
Data1.Recordset.AddNew
Command1.Caption = "确定"
Command2.Enabled = False
Command3.Enabled = False
Text1.SetFocus
Command1.Caption = "添加"
Command2.Enabled = True
Command3.Enabled = True
End If
End Sub
Private Sub Command2_Click()
On Error GoTo ErrMsg
Data1.Recordset.Edit
prompt = "是否修改该记录"
answer = MsgBox(prompt, vbYesNo)
If answer = vbYes Then
Data1.Recordset.Update
Else
Data1.Recordset.CancelUpdate
End If
Exit Sub
ErrMsg:
MsgBox Err.Description, vbExclamation, "出错"
End Sub
Private Sub Command3_Click()
Form2.Visible = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -