📄 modscore.frm
字号:
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3840
TabIndex = 16
Top = 1560
Width = 1095
End
Begin VB.Label Label21
Caption = "班级类型"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 240
TabIndex = 15
Top = 1440
Width = 975
End
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 2160
TabIndex = 8
Top = 240
Width = 1815
End
Begin VB.Label Label2
Caption = "请输入查询条件"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 59
Top = 240
Width = 1695
End
End
Begin VB.Frame Frame2
Height = 4695
Left = 9120
TabIndex = 0
Top = 0
Width = 1695
Begin VB.CommandButton Command10
Caption = "关闭(&C)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 240
TabIndex = 6
Top = 3840
Width = 1215
End
Begin VB.CommandButton Command9
Caption = "取消(&E)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 240
TabIndex = 5
Top = 3120
Width = 1215
End
Begin VB.CommandButton Command8
Caption = "查询(&Q)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 240
TabIndex = 4
Top = 2400
Width = 1215
End
Begin VB.CommandButton Command7
Caption = "更新(&R)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 240
TabIndex = 3
Top = 1680
Width = 1215
End
Begin VB.CommandButton Command6
Caption = "删除(&D)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 240
TabIndex = 2
Top = 960
Width = 1215
End
Begin VB.CommandButton Command5
Caption = "编辑(&M)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 240
TabIndex = 1
Top = 240
Width = 1215
End
End
End
Attribute VB_Name = "modscore"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mybookmark As Variant
Private Sub Command1_Click()
Command2.Enabled = True
Command3.Enabled = False
dream.MoveFirst '移动到数据集的第一条记录
Call viewdata '调用显示数据的函数
MsgBox "这是条一条记录!", 48, "注意!"
End Sub
Private Sub Command10_Click()
studentmdi.StatusBar1.Panels.Item(1).Text = " "
Unload Me
End Sub
Private Sub Command11_Click()
If Command11.Caption = "搜索(&S)" Then
If Not Testtxt(Text1.Text) Then
MsgBox "请输入学号!", 48, "提示"
'Text1.SetFocus
Else
txtSQL = "select * from score where 学号 like '%" & Text1.Text & "' OR 姓名 like '" & Text1.Text & "'"
Set dream = ExecuteSQL(txtSQL, Msgtext)
Call viewdata
End If
End If
End Sub
Private Sub Command12_Click()
'Dim mydate As String
'Text2.Text = Year(mydate)
End Sub
Private Sub Command2_Click()
Command3.Enabled = True
dream.MoveNext '数据集向后移动一条记录
If dream.EOF Then '判断是否终止位置
dream.MoveFirst
End If
Call viewdata
End Sub
Private Sub Command3_Click()
Command2.Enabled = True
dream.MovePrevious '数据集向前移动一条记录
If dream.BOF Then '判断是否到起始位置
dream.MoveLast
End If
Call viewdata
End Sub
Private Sub Command4_Click()
Command3.Enabled = True
Command2.Enabled = False
dream.MoveLast '移动到数据集的最后一条记录
Call viewdata
MsgBox "这是最后一条记录!", 48, "注意!"
End Sub
Private Sub Command5_Click()
If Command5.Caption = "编辑(&M)" Then
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
Text10.Enabled = True
Text11.Enabled = True
Text12.Enabled = True
Combo1.Enabled = True
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
mybookmark = dream.Bookmark '记下当前记录位置
End If
End Sub
Private Sub Command6_Click()
mybookmark = dream.Bookmark
str2$ = MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录")
If str2$ = vbOK Then
dream.MoveNext
If dream.EOF Then 'recordset is empty?
dream.MoveFirst
mybookmark = dream.Bookmark 'sign current position
dream.MoveLast
dream.Delete
dream.Close
txtSQL = "select * fromscore"
Set dream = ExecuteSQL(txtSQL, Msgtext)
dream.MoveLast
Call viewdata
Else
mybookmark = dream.Bookmark 'sign current position
dream.MovePrevious
dream.Delete
dream.Close
txtSQL = "select * from score"
Set dream = ExecuteSQL(txtSQL, Msgtext)
dream.MoveLast
Call viewdata
End If
Else
dream.Bookmark = mybookmark 'return primary position
Call viewdata
End If
End Sub
Private Sub Command7_Click()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
If dream.EOF = False Then
MsgBox "真的要更新吗?", vbOKCancel + vbExclamation, "警告"
'record current position
dream.Bookmark = mybookmark 'return to current modifty position
dream.Delete
txtSQL = "select * from score "
Set dream = ExecuteSQL(txtSQL, Msgtext)
dream.Bookmark = mybookmark 'return to current modifty position
dream.AddNew
dream.Fields(0) = Trim(Combo1.Text)
dream.Fields(1) = Trim(Text2.Text)
dream.Fields(2) = Trim(Text3.Text)
dream.Fields(3) = Trim(Text4.Text)
dream.Fields(4) = Trim(Text5.Text)
dream.Fields(5) = Trim(Text6.Text)
dream.Fields(6) = Trim(Text7.Text)
dream.Fields(7) = Trim(Text8.Text)
dream.Fields(8) = Trim(Text9.Text)
dream.Fields(9) = Trim(Text10.Text)
dream.Fields(10) = Trim(Text11.Text)
dream.Fields(11) = Trim(Text12.Text)
dream.Fields(12) = Trim(Text13.Text)
dream.Fields(13) = Trim(Text14.Text)
dream.Fields(14) = Trim(Text15.Text)
dream.Fields(15) = Trim(Text16.Text)
dream.Fields(16) = Trim(Text17.Text)
dream.Fields(17) = Trim(Text18.Text)
dream.Fields(18) = Trim(Text19.Text)
dream.Update
dream.Close
MsgBox "修改学生成绩成功!", vbOKOnly, "提示!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Combo1.Text = ""
End If
End Sub
Private Sub Command9_Click()
dream.Bookmark = mybookmark
Call viewdata
End Sub
Private Sub Form_Load()
Combo1.AddItem "期中考试"
Combo1.AddItem "期末考试"
Combo1.AddItem "统考"
Combo1.AddItem "会考"
Combo1.AddItem "测试"
'modscore.Height = 7575
'modscore.Width = 11175
txtSQL = "select * from score "
Set dream = ExecuteSQL(txtSQL, Msgtext) 'excute query opertion
If dream.EOF = False Then
dream.MoveFirst 'move first
Call viewdata 'display records
mybookmark = dream.Bookmark
Else
MsgBox "没有此记录!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
mybookmark = dream.Bookmark '记下当前记录的位置 mcbookmark-----mybookmark
'=======================================================
Text2.Enabled = False
Combo1.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
modscore.Caption = "修改学生成绩信息[" + Format(Date, "yyyy年mm月dd日]")
studentmdi.StatusBar1.Panels.Item(1).Text = "修改学生成绩信息"
End Sub
Public Sub viewdata() '由于程序中各处需要显示数据,定义函数ViewData
Combo1.Text = dream.Fields(0)
Text2.Text = dream.Fields(1)
Text3.Text = dream.Fields(2)
Text4.Text = dream.Fields(3)
Text5.Text = dream.Fields(4)
Text6.Text = dream.Fields(5)
Text7.Text = dream.Fields(6)
Text8.Text = dream.Fields(7)
Text9.Text = dream.Fields(8)
Text10.Text = dream.Fields(9)
Text11.Text = dream.Fields(10)
Text12.Text = dream.Fields(11)
Text13.Text = dream.Fields(12)
Text14.Text = dream.Fields(13)
Text15.Text = dream.Fields(14)
Text16.Text = dream.Fields(15)
Text17.Text = dream.Fields(16)
Text18.Text = dream.Fields(17)
Text19.Text = dream.Fields(18)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command11_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -