⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 formscoremanage.frm

📁 基于Visual Basic 6.0 与Access 2003的学籍管理系统,可以实现许多功能
💻 FRM
📖 第 1 页 / 共 2 页
字号:

    BookMK = dataScore.Recordset.Bookmark
    
Else

    BookMK = Null
    
End If

dataScore.Recordset.AddNew

'InEditMode = True

'ToggleEditMode

End Sub

Private Sub cmdCancel_Click()

dataScore.UpdateControls

'InEditMode = False

'ToggleEditMode

If Len(BookMK) > 0 Then

dataScore.Recordset.Bookmark = BookMK

ElseIf dataScore.Recordset.RecordCount > 0 Then

dataScore.Recordset.MoveFirst

End If

End Sub

Private Sub cmdDelete_Click()

Msg = MsgBox("确定要删除记录吗?", vbYesNo)

If Msg = vbYes Then

dataScore.Recordset.Delete

dataScore.Recordset.MoveNext

If dataScore.Recordset.EOF And (dataScore.Recordset.RecordCount > 0) Then

    dataScore.Recordset.MoveLast
    
End If

End If

End Sub

Private Sub cmdModify_Click()

If dataScore.Recordset.EOF Then Exit Sub

BookMK = dataScore.Recordset.Bookmark

dataScore.Recordset.Edit

'InEditMode = True

'ToggleEditMode

txtCourseID.Locked = True

End Sub

Private Sub cmdQuit_Click()

Unload Me

End Sub

Private Sub cmdSave_Click()

Dim strSQL$

txtCourseID.Text = Replace(Trim(txtCourseID.Text), "'", "")

txtCourseName.Text = Replace(Trim(txtCourseName.Text), "'", "")

txtStudentID.Text = Replace(Trim(txtStudentID.Text), "'", "")

txtName.Text = Replace(Trim(txtName.Text), "'", "")

txtScore.Text = Replace(Trim(txtScore.Text), "'", "")

If txtCourseID.Text = "" Then

    MsgBox "课程编号不能为空!", , "输入错误"
    
    txtCourseID.SetFocus
    
    Exit Sub
    
    ElseIf txtCourseName.Text = "" Then

     MsgBox "不存在该课程!", , "课程编号输入错误"
     
     txtCourseName.SetFocus
     
    Exit Sub
    
End If
    
    If txtStudentID.Text = "" Then
    
     MsgBox "学号不能为空!", , "输入错误"
     
     txtStudentID.SetFocus
     
     Exit Sub
      
ElseIf txtName.Text = "" Then
     
      MsgBox "不存在这个学生!", , "学号输入错误"
    
      txtStudentID.SetFocus
      
      Exit Sub

End If

If txtScore.Text = "" Then
     
     MsgBox "分数不能为空!", , "输入错误"
    
     txtScore.SetFocus
    
      Exit Sub
      
End If

    strSQL = "SELECT * FROM CourseSelect WHERE StudentID = '" & txtStudentID.Text & "'"
    
    dataValid.RecordSource = strSQL
    
    dataValid.Refresh
    
If Not dataValid.Recordset.EOF Then

    strSQL = "SELECT * FROM CourseSelect WHERE CourseID = '" & txtCourseID.Text & "'"
    
    dataValid1.RecordSource = strSQL
    
    dataValid1.Refresh

    If Not dataValid1.Recordset.EOF Then
    
    strSQL = "SELECT * FROM Scores WHERE CourseID = '" & txtCourseID.Text & "' AND StudentID = '" & txtStudentID.Text & "'"
    
    dataValid2.RecordSource = strSQL
    
    dataValid2.Refresh
    
    If dataValid2.Recordset.EOF Then
    
    dataScore.UpdateRecord
    
    If Len(BookMK) > 0 Then

    dataScore.Recordset.Bookmark = BookMK

    ElseIf dataScore.Recordset.RecordCount > 0 Then

    dataScore.Recordset.MoveFirst

    End If
    
    Else
    
    MsgBox "学生[" & txtStudentID.Text & "]已经拥有课程[" & txtCourseID & "]的成绩了"
    
    End If
    
    Exit Sub

End If

    strSQL = "SELECT * FROM CourseSelect WHERE CourseID = '" & txtCourseID.Text & "'"
    
    dataValid1.RecordSource = strSQL
    
    dataValid1.Refresh
    
End If

If Not dataValid1.Recordset.EOF Then

    strSQL = "SELECT * FROM CourseSelect WHERE StudentID = '" & txtStudentID.Text & "'"
    
    dataValid.RecordSource = strSQL
    
    dataValid.Refresh

    If Not dataValid.Recordset.EOF Then
    
    strSQL = "SELECT * FROM Scores WHERE CourseID = '" & txtCourseID.Text & "' AND StudentID = '" & txtStudentID.Text & "'"
    
    dataValid2.RecordSource = strSQL
    
    dataValid2.Refresh
    
    If dataValid2.Recordset.EOF Then
    
    dataScore.UpdateRecord

'InEditMode = False

'ToggleEditMode

    If Len(BookMK) > 0 Then

    dataScore.Recordset.Bookmark = BookMK

    ElseIf dataScore.Recordset.RecordCount > 0 Then

    dataScore.Recordset.MoveFirst

    End If
    
    Else
    
    MsgBox "学生[" & txtStudentID.Text & "]已经拥有课程[" & txtCourseID & "]的成绩了"
    
    End If
    
    Exit Sub

    End If
    
    End If

Msg = "学生[" & txtStudentID.Text & "] 没有选课程[" & txtCourseID.Text & "]!"
    
MsgBox Msg

End Sub

Private Sub Form_Load()

'dataCourseSelect.DatabaseName = App.Path & "\StudentMIS.mdb"

dataCourse.DatabaseName = App.Path & "\StudentMIS.mdb"

dataStudent.DatabaseName = App.Path & "\StudentMIS.mdb"

dataScore.DatabaseName = App.Path & "\StudentMIS.mdb"

dataValid.DatabaseName = App.Path & "\StudentMIS.mdb"

dataValid1.DatabaseName = App.Path & "\StudentMIS.mdb"

dataValid2.DatabaseName = App.Path & "\StudentMIS.mdb"

dataValid2.Visible = False

dataValid.Visible = False

dataValid1.Visible = False



'dataCourseSl.Visible = False

dataCourse.Visible = False

dataStudent.Visible = False

dataScore.Visible = False

'dataValid.DatabaseName = App.Path & "\StudentMIS.mdb"

'dataValid.Visible = False

'InEditMode = False

'ToggleEditMode

End Sub

Private Sub Form_Unload(Cancel As Integer)

'If InEditMode Then

'dataCourseSelect.UpdateControls

'InEditMode = False

'ToggleEditMode

'End If

End Sub

Private Sub txtCourseID_Change()

strSQL = "SELECT * FROM Course WHERE CourseID = '" & txtCourseID.Text & "'"

dataCourse.RecordSource = strSQL

dataCourse.Refresh


End Sub

Private Sub txtStudentID_Change()

strSQL = "SELECT * FROM Student WHERE StudentID ='" & txtStudentID.Text & "'"

dataStudent.RecordSource = strSQL

dataStudent.Refresh

End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -