📄 frmcjxbzycx.frm
字号:
' 显示课程名称
Cell1.DoSetCellAlignment numcol, 0, 36
Cell1.DoSetCellReadOnly numcol, 0, True
Select Case Trim(objRs("pffs" & Trim(Str(numI))))
' 根据该课程的评分方式,形成表头内容
Case "0"
Cell1.DoSetCellString numcol, 1, "总成绩"
Cell1.DoSetCellAlignment numcol, 1, 36
Cell1.DoSetCellReadOnly numcol, 1, True
Case "1"
Cell1.DoAppendCol 2
Cell1.DoJoinCells numcol, 0, numcol + 2, 0
Cell1.DoSetCellString numcol, 1, "理论成绩"
Cell1.DoSetCellString numcol + 1, 1, "实训成绩"
Cell1.DoSetCellString numcol + 2, 1, "总成绩"
Cell1.DoSetCellAlignment numcol, 1, 36
Cell1.DoSetCellAlignment numcol + 1, 1, 36
Cell1.DoSetCellAlignment numcol + 2, 1, 36
Cell1.DoSetCellReadOnly numcol, 1, True
Cell1.DoSetCellReadOnly numcol + 1, 1, True
Cell1.DoSetCellReadOnly numcol + 2, 1, True
numcol = numcol + 2
Case "2"
Cell1.DoSetCellString numcol, 1, "学分"
Cell1.DoSetCellAlignment numcol, 1, 36
Cell1.DoSetCellReadOnly numcol, 1, True
Case "3"
Cell1.DoSetCellString numcol, 1, "考查成绩"
Cell1.DoSetCellAlignment numcol, 1, 36
Cell1.DoSetCellReadOnly numcol, 1, True
End Select
numcol = numcol + 1
End If
Next
'开始显示学号、姓名和已经录入的成绩
strExec = "Select * From " & fSckcbmc(Text1.Text, Combo1.Text, Combo2.Text, Combo5.Text)
If Trim(Text2.Text) <> "" Then
' 按班级排榜,所以形成多级查询语句
strExec = strExec & " Where xh In (Select xh From XSDAB Where nj='" & Trim(Text1.Text) & _
"' And xbbh='" & Trim(fGetXbbh(Combo1.Text)) & _
"' And zybh='" & Trim(fGetZybh(Combo2.Text)) & "' And bj='" & Trim(Text2.Text) & "')"
End If
Set objRs1 = objCon.Execute(strExec)
If objRs1.EOF Then
' 没有录入过成绩
MsgBox "没有找到成绩数据!", vbCritical, "错误信息"
Else
numRow = 2
' 行编号
Do While Not objRs1.EOF
Cell1.DoAppendRow 1
Cell1.DoSetCellString 0, numRow, Trim(objRs1("xh"))
' 学号
Cell1.DoSetCellReadOnly 0, numRow, True
Cell1.DoSetCellString 1, numRow, Trim(fGetXm(objRs1("xh")))
' 由fGetXm(学号)获得姓名
Cell1.DoSetCellReadOnly 1, numRow, True
numcol = 2
For numI = 1 To 10
If objRs("kcbh" & Trim(Str(numI))) <> "" Then
' 第numI个课程为要查询的课程
Select Case Trim(objRs("pffs" & Trim(Str(numI))))
' 根据该课程的评分方式,形成成绩数据
Case "0"
If objRs1("zcj" & Trim(Str(numI))) <> 0 Then
Cell1.DoSetCellData numcol, numRow, objRs1("zcj" & Trim(Str(numI)))
End If
Case "1"
If objRs1("llcj" & Trim(Str(numI))) <> 0 Then
Cell1.DoSetCellData numcol, numRow, objRs1("llcj" & Trim(Str(numI)))
End If
If objRs1("sxcj" & Trim(Str(numI))) <> 0 Then
Cell1.DoSetCellData numcol + 1, numRow, objRs1("sxcj" & Trim(Str(numI)))
End If
If objRs1("zcj" & Trim(Str(numI))) <> 0 Then
Cell1.DoSetCellData numcol + 2, numRow, objRs1("zcj" & Trim(Str(numI)))
End If
numcol = numcol + 2
Case "2"
If objRs1("xf" & Trim(Str(numI))) <> 0 Then
Cell1.DoSetCellData numcol, numRow, objRs1("xf" & Trim(Str(numI)))
End If
Case "3"
If Trim(objRs1("kccj" & Trim(Str(numI)))) <> "" Then
Cell1.DoSetCellString numcol, numRow, Trim(objRs1("kccj" & Trim(Str(numI))))
End If
End Select
numcol = numcol + 1
End If
Next
numRow = numRow + 1
objRs1.MoveNext
Loop
Command2.Enabled = True
' 允许打印
End If
objRs1.Close
Else
MsgBox "指定条件的课程表还没有生成!", vbCritical, "错误信息"
Command2.Enabled = False
' 不允许打印
End If
objRs.Close
End If
End Sub
'***************************************************************************************
' 过程:Command2_Click
' 功能:打印已经查询的课程成绩
'***************************************************************************************
Private Sub Command2_Click()
MsgBox "请在打印机中放入A3或宽行打印纸...", vbOKOnly, "数据打印"
Load FrmPrePrint
' 调入打印预览窗口
Cell1.DoCopyArea 0, 0, Cell1.Cols - 1, Cell1.Rows - 1
' 复制数据到剪贴板中
FrmPrePrint.Cell1.DoPaste 0, 0, True
' 粘贴数据到打印窗口中
FrmPrePrint.Cell1.Cols = Cell1.Cols
FrmPrePrint.Cell1.Rows = Cell1.Rows
FrmPrePrint.Cell1.DoInsertRow 0, 1
' 设置报表标题
FrmPrePrint.Cell1.DoJoinCells 0, 0, FrmPrePrint.Cell1.Cols - 1, 0
FrmPrePrint.Cell1.DoSetRowHeight 0, 60
FrmPrePrint.Cell1.DoSetCellFont 0, 0, 12, 1, "宋体"
' 12号宋体字,粗体
FrmPrePrint.Cell1.DoSetCellString 0, 0, Trim(Combo1.Text) & Trim(Combo2.Text) & Trim(Text1.Text) & "级" & IIf(Len(Text2.Text) = 0, "", Trim(Text2.Text)) & "第" & Trim(Combo5.Text) & "学期成绩"
FrmPrePrint.Cell1.DoSetCellAlignment 0, 0, 36
' 设置页脚:页号 日期
FrmPrePrint.Cell1.DoSetPrintFoot "", "&P &D", ""
' 显示网格
FrmPrePrint.Cell1.DoDrawLine 0, 1, FrmPrePrint.Cell1.Cols, FrmPrePrint.Cell1.Rows, 0, 1, 0
FrmPrePrint.Cell1.DoSetPrintPara 1, 8, False
FrmPrePrint.Cell1.DoPrintPreview True
Unload FrmPrePrint
End Sub
'***************************************************************************************
' 过程:Form_Load
' 功能:窗体装入时进行初始化
'***************************************************************************************
Private Sub Form_Load()
Set objRs = objCon.Execute("Select Distinct xbmc From XBMCB")
' 形成系别名称列表
Do While Not objRs.EOF
Combo1.AddItem Trim((objRs("xbmc")))
objRs.MoveNext
Loop
Set objRs = objCon.Execute("Select Distinct zymc From ZYMCB")
' 形成专业名称列表
Do While Not objRs.EOF
Combo2.AddItem Trim((objRs("zymc")))
objRs.MoveNext
Loop
objRs.Close
Command1.Enabled = True
Command2.Enabled = False
' 初始阶段不允许使用“打印”按钮
Cell_Setup Cell1
End Sub
'***************************************************************************************
' 过程:Form_QueryUnload
' 功能:窗体关闭时恢复主窗口
'***************************************************************************************
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
FrmMain.Enabled = True
End Sub
'***************************************************************************************
' 过程:Command3_Click
' 功能:“关闭”按钮按下时恢复主窗口
'***************************************************************************************
Private Sub Command3_Click()
FrmMain.Enabled = True
Unload FrmCjxbzycx
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -