Private Sub Cmd查询_Click()
    Dim numI As Integer, numJ As Integer
    If Trim(Combo4.Text) = "" Then
       txtSQL = "Select * From 学生信息表视图 where 专业编号 = '" & a专业(Combo2.ListIndex) & "' and 年级 = '" & Combo3.Text & "' order by 年级, 专业编号, 班级编号, 学号"
    Else
       txtSQL = "Select * From 学生信息表视图 where 专业编号 = '" & a专业(Combo2.ListIndex) & "' and 年级 = '" & Combo3.Text & "' and 班级编号 = '" & a班级(Combo4.ListIndex) & "' order by 年级, 专业编号, 班级编号, 学号"
    End If
    Set objRs = ExecuteSQL(txtSQL, msg_Sql)
    rs = objRs.RecordCount
    If objRs.EOF Then
        MsgBox "没有找到任何记录，请检查您的查询条件！", vbCritical, "系统信息"
        Cmd打印.Enabled = False
    Else
        Cmd打印.Enabled = True
        numI = 3
        Cell1.DoResetContent
        Cell1_Setup Cell1
        Do While Not objRs.EOF
            Cell1.DoAppendRow 1
            Cell1.DoSetCellString 0, numI, Trim(objRs("学号"))
            Cell1.DoSetCellString 1, numI, Trim(objRs("姓名"))
            Cell1.DoSetCellString 2, numI, Trim(objRs("性别"))
            Cell1.DoSetCellAlignment 2, numI, 36
            Cell1.DoSetCellString 3, numI, Trim(objRs("出生年月"))
            Cell1.DoSetCellString 4, numI, Trim(objRs("民族"))
            Cell1.DoSetCellAlignment 4, numI, 36
            Cell1.DoSetCellString 5, numI, Trim(objRs("政治面貌"))
            Cell1.DoSetCellString 6, numI, Trim(objRs("身份证号"))
            If Not IsNull(objRs("籍贯")) Then Cell1.DoSetCellString 7, numI, Trim(objRs("籍贯"))
            Cell1.DoSetCellString 8, numI, Trim(objRs("家庭地址"))
            Cell1.DoSetCellString 9, numI, Trim(objRs("邮政编码"))
            Cell1.DoSetCellString 10, numI, Trim(objRs("联系电话"))
            For numJ = 0 To 10
               Cell1.DoSetCellReadOnly numJ, numI, True
            Next numJ
            objRs.MoveNext
            numI = numI + 1
        Loop
    End If
    Cell1.DoSetUnScrollRow 0, 2
    Cell1.DoSetUnScrollCol 0, 1
    objRs.Close
End Sub


