?? frmscoi.frm
字號:
mrc.MoveNext
Loop
End With
End If
Combo2(1).Clear
Combo2(2).Clear
Text2(2) = ""
End Sub
Private Sub Command4_Click()
Dim txtSQL As String
Text2(1) = ""
txtSQL = "select DISTINCT score_Cla from score_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
With Combo2(0)
.Clear
Do While Not mrc.EOF
.AddItem Trim(mrc!score_Cla)
mrc.MoveNext
Loop
End With
End If
Combo2(1).Clear
Combo2(2).Clear
Text2(2) = ""
End Sub
Private Sub Command5_Click()
Dim j As Integer
Dim txtSQL As String
If Text3(0) = "" Then
MsgBox "清選擇要修改的紀錄!", vbOKOnly, "提示"
MSFlexGrid1.SetFocus
Exit Sub
End If
If Text3(1) = "" Then
MsgBox "考試期號不能為空!", vbOKOnly, "提示"
Text3(1).SetFocus
Exit Sub
End If
If Combo3(0).Text = "" Then
MsgBox "學生班號不能為空!", vbOKOnly, "提示"
Combo3(0).SetFocus
Exit Sub
End If
If Combo3(1).Text = "" Then
MsgBox "學生編號不能為空!", vbOKOnly, "提示"
Combo3(1).SetFocus
Exit Sub
End If
If Combo3(2).Text = "" Then
MsgBox "考試課程不能為空!", vbOKOnly, "提示"
Combo3(2).SetFocus
Exit Sub
End If
If Text3(2) = "" Then
MsgBox "考試分數不能為空!", vbOKOnly, "提示"
Text3(2).SetFocus
Exit Sub
End If
txtSQL = "select * from score_Form where score_NO<>'" & Trim(Text3(0)) & "' And score_Per='" & Trim(Text3(1)) & "' and score_Cla='" & Trim(Combo3(0).Text) & "' and score_Stu='" & Trim(Combo3(1).Text) & "'And score_Cou='" & Trim(Combo3(2).Text) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "同次同人同科只能添加一次", vbOKOnly, "警告"
Text3(2) = ""
Combo3(0).SetFocus
Exit Sub
End If
txtSQL = "Delete from score_Form where score_NO='" & Trim(Text3(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
txtSQL = "select * from score_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Text3(0))
mrc.Fields(1) = Trim(Text3(1))
mrc.Fields(2) = Trim(Combo3(0).Text)
mrc.Fields(3) = Trim(Combo3(1).Text)
mrc.Fields(4) = Trim(Combo3(2).Text)
mrc.Fields(5) = Trim(Text3(2))
mrc.Update
mrc.Close
MsgBox "考試信息修改成功!", vbOKOnly, "提示"
j = 0
For i = 1 To MSFlexGrid1.Rows - 1
If MSFlexGrid1.TextMatrix(i, 0) = Text3(0) Then
j = i
End If
Next
If j <> 0 Then
With MSFlexGrid1
.TextMatrix(j, 0) = Trim(Text3(0))
.TextMatrix(j, 1) = Trim(Text3(1))
.TextMatrix(j, 2) = Trim(Combo3(0).Text)
.TextMatrix(j, 3) = Trim(Combo3(1).Text)
.TextMatrix(j, 4) = Trim(Combo3(2).Text)
.TextMatrix(j, 5) = Trim(Text3(2))
End With
End If
Text3(0) = ""
Text3(1) = ""
Combo3(0).Clear
Combo3(1).Clear
Combo3(2).Clear
Text3(2) = ""
MSFlexGrid1.TopRow = j
j = 0
End Sub
Private Sub Command6_Click()
Text3(0) = ""
Text3(1) = ""
Combo3(0).Clear
Combo3(1).Clear
Combo3(2).Clear
Text3(2) = ""
End Sub
Private Sub Command7_Click()
Dim j As Integer
Dim txtSQL As String
If Text4(0) = "" Then
MsgBox "清選擇要刪除的紀錄!", vbOKOnly, "提示"
MSFlexGrid1.SetFocus
Exit Sub
End If
txtSQL = "Delete from score_Form where score_NO='" & Trim(Text4(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
MsgBox "考試信息修改成功!", vbOKOnly, "提示"
j = 0
For i = 1 To MSFlexGrid1.Rows - 1
If MSFlexGrid1.TextMatrix(i, 0) = Text4(0) Then
j = i
End If
Next
If j <> 0 Then
With MSFlexGrid1
.TextMatrix(j, 0) = "已刪除"
.TextMatrix(j, 1) = "已刪除"
.TextMatrix(j, 2) = "已刪除"
.TextMatrix(j, 3) = "已刪除"
.TextMatrix(j, 4) = "已刪除"
.TextMatrix(j, 5) = "已刪除"
End With
End If
Text4(0) = ""
Text4(1) = ""
Combo4(0).Clear
Combo4(1).Clear
Combo4(2).Clear
Text4(2) = ""
End Sub
Private Sub Command8_Click()
Text4(0) = ""
Text4(1) = ""
Combo4(0).Clear
Combo4(1).Clear
Combo4(2).Clear
Text4(2) = ""
End Sub
Private Sub Form_Load()
Option1(1).Value = True
Picture1(0).Visible = False
Picture1(1).Visible = True
Picture1(2).Visible = False
Picture1(3).Visible = False
Picture1(1).Top = Picture1(0).Top
Picture1(1).Left = Picture1(0).Left
Picture1(2).Top = Picture1(0).Top
Picture1(2).Left = Picture1(0).Left
Picture1(3).Top = Picture1(0).Top
Picture1(3).Left = Picture1(0).Left
With MSFlexGrid1
.Cols = 6
.TextMatrix(0, 1) = "考試期號"
.TextMatrix(0, 2) = "學生班號"
.TextMatrix(0, 3) = "學生編號"
.TextMatrix(0, 4) = "考試課程"
.TextMatrix(0, 5) = "考試分數"
.ColWidth(0) = 0
.ColWidth(1) = 1550
.ColWidth(2) = 1550
.ColWidth(3) = 1550
.ColWidth(4) = 1550
.ColWidth(5) = 1550
.Rows = 1
End With
Text1(0) = GetRkno
End Sub
Private Sub Form_Resize()
dColor.ZOrder 1
End Sub
Private Sub MSFlexGrid1_Click()
Dim txtSQL As String
If MSFlexGrid1.Row <> 0 Then
Text3(0) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)
Text3(1) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)
Combo3(0).Clear
Combo3(0).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2)
Combo3(0).ListIndex = 0
txtSQL = "select * from class_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
With Combo3(0)
Do While Not mrc.EOF
If mrc!class_NO <> .Text Then
.AddItem Trim(mrc!class_NO)
End If
mrc.MoveNext
Loop
End With
End If
Combo3(1).Clear
Combo3(1).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3)
Combo3(1).ListIndex = 0
Combo3(2).Clear
Combo3(2).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4)
Combo3(2).ListIndex = 0
Text3(2) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 5)
Text4(0) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 0)
Text4(1) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)
Combo4(0).Clear
Combo4(0).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2)
Combo4(0).ListIndex = 0
Combo4(1).Clear
Combo4(1).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3)
Combo4(1).ListIndex = 0
Combo4(2).Clear
Combo4(2).AddItem MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4)
Combo4(2).ListIndex = 0
Text4(2) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 5)
End If
End Sub
Private Sub Option1_Click(Index As Integer)
Dim txSQL As String
Me.Caption = "成績信息->"
Me.Caption = Me.Caption & Option1(Index).Caption
Option1(0).BackColor = &HC0C0C0
Option1(1).BackColor = &HC0C0C0
Option1(2).BackColor = &HC0C0C0
Option1(3).BackColor = &HC0C0C0
Option1(Index).BackColor = &H80000005
Picture1(0).Visible = False
Picture1(1).Visible = False
Picture1(2).Visible = False
Picture1(3).Visible = False
Picture1(Index).Visible = True
txSQL = "select * from class_Form"
Set mrc = ExecuteSQL(txSQL, MsgText)
If mrc.EOF = True Then
MsgBox "請先進行班級設置!", vbOKOnly, "提示"
Else
With Combo1(0)
.Clear
Do While Not mrc.EOF
.AddItem Trim(mrc!class_NO)
mrc.MoveNext
Loop
End With
End If
txSQL = "select DISTINCT score_Cla from score_Form"
Set mrc = ExecuteSQL(txSQL, MsgText)
If mrc.EOF = False Then
With Combo2(0)
.Clear
Do While Not mrc.EOF
.AddItem Trim(mrc!score_Cla)
mrc.MoveNext
Loop
End With
End If
Text3(0) = ""
Text3(1) = ""
Combo3(0).Clear
Combo3(1).Clear
Combo3(2).Clear
Text3(2) = ""
Text4(0) = ""
Text4(1) = ""
Combo4(0).Clear
Combo4(1).Clear
Combo4(2).Clear
Text4(2) = ""
End Sub
Private Function GetRkno() As String
GetRkno = Format(Now, "yymmddhhmmss")
Randomize
GetRkno = GetRkno & Int((99 - 10 + 1) * Rnd + 10)
End Function
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If Index = 2 Then
If KeyAscii = 190 Then
If InStr(Trim(Text1(Index)), ".") = 0 Then
If Len(Trim(Text1(Index))) > 0 Then
Text1(Index).Locked = False
Else
Text1(Index).Locked = True
End If
Else
Text1(Index).Locked = True
End If
Exit Sub
End If
If KeyAscii > 57 Or KeyAscii < 48 Then
Text1(Index).Locked = True
Else
Text1(Index).Locked = False
End If
If KeyAscii = 8 Then
Text1(Index).Locked = False
End If
If KeyAscii = 46 Then
Text1(Index).Locked = False
End If
End If
End Sub
Private Sub Text3_KeyPress(Index As Integer, KeyAscii As Integer)
If Index = 2 Then
If KeyAscii = 190 Then
If InStr(Trim(Text1(Index)), ".") = 0 Then
If Len(Trim(Text1(Index))) > 0 Then
Text1(Index).Locked = False
Else
Text1(Index).Locked = True
End If
Else
Text1(Index).Locked = True
End If
Exit Sub
End If
If KeyAscii > 57 Or KeyAscii < 48 Then
Text1(Index).Locked = True
Else
Text1(Index).Locked = False
End If
If KeyAscii = 8 Then
Text1(Index).Locked = False
End If
If KeyAscii = 46 Then
Text1(Index).Locked = False
End If
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -