📄 新增班级.frm
字号:
VERSION 5.00
Begin VB.Form Form3
Caption = "Form3"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form3"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "退出"
Height = 495
Left = 2640
TabIndex = 5
Top = 2160
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 960
TabIndex = 4
Top = 2160
Width = 1455
End
Begin VB.TextBox Text2
Height = 495
Left = 1680
TabIndex = 3
Text = "A03计算机1班"
Top = 960
Width = 2655
End
Begin VB.TextBox Text1
Height = 375
Left = 1680
MaxLength = 7
TabIndex = 2
Top = 360
Width = 1575
End
Begin VB.Label Label2
Caption = "输入班级名称:"
Height = 375
Left = 360
TabIndex = 1
Top = 960
Width = 1575
End
Begin VB.Label Label1
Caption = "输入班级编号:"
Height = 255
Left = 360
TabIndex = 0
Top = 360
Width = 1455
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Form1.rec_class.Close
Form1.rec_class.Open "select * from class where class_no =" & Text1.Text
If Form1.rec_class.RecordCount = 0 Then
Form1.rec_class.AddNew
Form1.rec_class.Fields(0).Value = Text1.Text '有班级表中插入一个班级
Form1.rec_class.Fields(1).Value = Text2.Text
Form1.rec_class.Update
MsgBox "班级添加成功!"
Unload Me
Else
MsgBox "该班级已存在!", vbCritical
End If
Form1.rec_class.Close
Form1.rec_class.Open "select * from class"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -