VB学生信息管理系统 第8页

VB学生信息管理系统 第8页

 End If

 

Next i

   mrc.Update

   MsgBox " 用户添加成功!", vbExclamation + vbOKOnly, "警告"

   Text1(0).Text = ""

   Text1(1).Text = ""

   Text1(2).Text = ""

End Sub

 

Private Sub Command2_Click()

Unload Me

End Sub

 

Private Sub Form_Load()

 

Option1(2).Value = True

End Sub

 

Private Sub Form_Resize()

Text1(0).SetFocus

End Sub

 

Private Sub Option1_Click(Index As Integer)

If Index <> 2 Then

For i = 0 To 3

  Check1(i).Enabled = False

Next i

Else

For i = 0 To 3

  Check1(i).Enabled = True

Next i

End If

End Sub

44学生缴费管理模块:

因为本系统中有些功能模块具有相似之处,因此在本文只用此模块进行一个简单的说明。其它的相似模块的代码可能参阅本模块的设计思路。

Public printstr As String

Private Sub Command1_Click()

 

    Dim dbSource As Database

    

    Set dbSource = OpenDatabase("xs.mdb")

    dbSource.Execute ("SELECT * INto 班级一览表 IN '学生管理一览表.xls' 'EXCEL 5.0;' FROM class")

  z = MsgBox("成功!", vbOKOnly, "查询")

End Sub

Public Sub classshowtitle()

 Dim i As Integer

 MSF1.Clear

  With MSF1

    .Cols = 8

    .TextMatrix(0, 1) = "年级"

    .TextMatrix(0, 2) = "班级"

    .TextMatrix(0, 3) = "教室"

    .TextMatrix(0, 4) = "年制"

    .TextMatrix(0, 5) = "专业"

    .TextMatrix(0, 6) = "班主任"

    .TextMatrix(0, 7) = "备注"

    .ColWidth(0) = 100

    .ColWidth(1) = 1300

    .ColWidth(2) = 1200

    .ColWidth(3) = 800

    .ColWidth(4) = 800

    .ColWidth(5) = 800

    .ColWidth(6) = 800

    .ColWidth(7) = 5000

   

    .FixedRows = 1

    For i = 1 To 7

      .ColAlignment(i) = 0

    Next i

    .FillStyle = flexFillSingle

    .Col = 0

    .Row = 0

    .RowSel = 1

    .ColSel = .Cols - 1

    .CellAlignment = 4

    .Row = 1

    End With

End Sub

 

Public Sub classshowdata()

Dim j As Integer

Dim i As Integer

 

Dim mrc1 As ADODB.Recordset

 

  Set mrc1 = ExecuteSQL(Trim(txtsql))

 

  If mrc1.EOF = False Then

   mrc1.MoveFirst

   With MSF1

    .Rows = 1

    Do While Not mrc1.EOF

     .Rows = .Rows + 1

     For i = 1 To mrc1.Fields.Count

      .TextMatrix(.Rows - 1, i) = mrc1.Fields(i - 1)

     Next i

     mrc1.MoveNext

    Loop

    mrc1.Close

 End With

 Else

 

   If classfind = True Then

    Formclass2.Hide

    Formclass3.Show

    zzz = MsgBox("对不起,没有此班级的档案记录!", vbOKOnly, "查询")

    Formclass3.ZOrder (0)

    Formclass3.Text1(0).SetFocus

   End If

 End If

 

End Sub

 

 

 

Private Sub cmddel_Click()

qxstr = Executeqx(2)

            If qxstr = "readonly" Then

            ss = MsgBox("对不起,你是只读用户不能删除记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")

              Exit Sub

               End If

              Dim mrc As ADODB.Recordset

               Dim msgtext As String

              Dim intcount As Integer

                If Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) = "" Then

                 sssss = MsgBox("你还没有选择记录!", vbOKOnly + vbExclamation, "警告")

                Exit Sub

             End If

              If MsgBox("确定要删除班级为 " & Trim(Me.MSF1.TextMatrix(MSF1.Row, 2)) & " 的记录吗?" & Chr(13) & Chr(10) & "继续会导致该班级在成绩和学费记录的数据丢失,继续吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then

                txtsql = "delete * from xj where 班级='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 2)) & "'"

                 Set mrc = ExecuteSQL(txtsql)

               txtsql = "delete * from jf where 学号 in (select from xj where 班级='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 2)) & "')"

                Set mrc = ExecuteSQL(txtsql) '删除在交费表中的所有该班级的记录

              txtsql = "delete * from cj where 学号 in (select from xj where 班级='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 2)) & "')"

                  Set mrc = ExecuteSQL(txtsql) '删除在成绩表中的所有该班级的记录

                   txtsql = "delete * from class where 班级='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 2)) & "'"

                Set mrc = ExecuteSQL(txtsql) '删除该班级的记录

              

                 End If

 

 zxh = MsgBox("记录成功删除!", vbOKOnly, "查询")

              txtsql = "select* from class "

              classshowtitle

              classshowdata

             Call Form_Activate

End Sub

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有