📄 pingfen.frm
字号:
VERSION 5.00
Begin VB.Form pingfen
Caption = "寝室评分录入"
ClientHeight = 5805
ClientLeft = 60
ClientTop = 450
ClientWidth = 8430
LinkTopic = "Form1"
LockControls = -1 'True
MDIChild = -1 'True
ScaleHeight = 5805
ScaleWidth = 8430
Begin VB.Frame Frame2
Height = 975
Left = 240
TabIndex = 13
Top = 4560
Width = 7935
Begin VB.CommandButton Command3
Caption = "退出"
Height = 375
Left = 5640
TabIndex = 16
Top = 360
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3600
TabIndex = 15
Top = 360
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
Default = -1 'True
Height = 375
Left = 1440
TabIndex = 14
Top = 360
Width = 1215
End
End
Begin VB.Frame Frame1
Height = 3615
Left = 240
TabIndex = 0
Top = 840
Width = 7935
Begin VB.TextBox Text5
Height = 1095
Left = 1680
TabIndex = 11
Top = 2160
Width = 5655
End
Begin VB.TextBox Text4
Height = 375
Left = 5280
TabIndex = 9
Top = 1080
Width = 2055
End
Begin VB.TextBox Text3
Height = 375
Left = 1680
TabIndex = 7
Top = 1080
Width = 2055
End
Begin VB.TextBox Text2
Height = 375
Left = 5280
TabIndex = 4
Top = 360
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
Left = 1680
TabIndex = 2
Top = 360
Width = 2055
End
Begin VB.Line Line2
BorderColor = &H8000000A&
X1 = 0
X2 = 7920
Y1 = 1800
Y2 = 1800
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "备 注:"
Height = 180
Left = 600
TabIndex = 10
Top = 2520
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "年 份:"
Height = 180
Left = 4200
TabIndex = 8
Top = 1200
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "第 几 周:"
Height = 180
Left = 600
TabIndex = 6
Top = 1200
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = " "
Height = 180
Left = 720
TabIndex = 5
Top = 1320
Width = 90
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "评 分:"
Height = 180
Left = 4200
TabIndex = 3
Top = 480
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "寝 室 号:"
Height = 180
Left = 600
TabIndex = 1
Top = 480
Width = 900
End
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "寝室评分录入表"
BeginProperty Font
Name = "幼圆"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 3000
TabIndex = 12
Top = 240
Width = 2520
End
Begin VB.Line Line1
X1 = 240
X2 = 8160
Y1 = 2040
Y2 = 2040
End
End
Attribute VB_Name = "pingfen"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
'判断各个输入框中是否为空
If Me.Text1.Text = "" Then
MsgBox "请输入寝室号!", vbOKOnly + vbExclamation, "警告"
Me.Text1.SetFocus
Me.Text1.Text = ""
Exit Sub
End If
If Me.Text2.Text = "" Then
MsgBox "评分标准为多少?,请输入!", vbOKOnly + vbExclamation, "警告"
Me.Text2.SetFocus
Exit Sub
End If
If Me.Text3.Text = "" Then
MsgBox "请输入周!", vbOKOnly + vbExclamation, "警告"
Me.Text3.SetFocus
Exit Sub
End If
If Me.Text4.Text = "" Then
MsgBox "请输入年份!", vbOKOnly + vbExclamation, "警告"
Me.Text4.SetFocus
Exit Sub
End If
'先查询学生表中是否存在这样的一个寝室号
txtSQL = "select * from student_if where qinshi_ID= '" & Trim(Me.Text1.Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
'如果学生表中存在该寝室号,则开始执行下面代码
'开始查询数据库里的寝室号是否重复
txtSQL = "select qinshi_ID from qinshi_pingfen where qinshi_ID = '" & Trim(Me.Text1.Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "这个寝室已经有过评分,请重新输入!", vbOKOnly + vbExclamation, "警告"
mrc.Close
Me.Text1.Text = ""
Me.Text1.SetFocus
Else
mrc.Close
txtSQL = "select * from qinshi_pingfen"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew '添加一条记录
mrc.Fields(0) = Trim(Me.Text1.Text)
mrc.Fields(1) = Trim(Me.Text2.Text)
mrc.Fields(2) = Trim(Me.Text3.Text)
mrc.Fields(3) = Trim(Me.Text4.Text)
mrc.Fields(4) = Trim(Me.Text5.Text)
mrc.Update
MsgBox "评分录入成功!", vbOKOnly + vbExclamation, "提示"
mrc.Close
'把所有的控件里的内容清空
Me.Text1.Text = ""
Me.Text2.Text = ""
Me.Text3.Text = ""
Me.Text4.Text = ""
Me.Text5.Text = ""
End If
Else
MsgBox "不存在这个寝室,请重新输入!", vbOKOnly + vbExclamation, "警告"
mrc.Close
Me.Text1.Text = ""
Me.Text1.SetFocus
End If
End Sub
Private Sub Command2_Click()
Me.Text1.Text = ""
Me.Text2.Text = ""
Me.Text3.Text = ""
Me.Text4.Text = ""
Me.Text5.Text = ""
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -