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

📄 formcoursearrange.frm

📁 基于Visual Basic 6.0 与Access 2003的学籍管理系统,可以实现许多功能
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Top             =   600
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "课程编号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1200
      TabIndex        =   0
      Top             =   600
      Width           =   855
   End
End
Attribute VB_Name = "frmCourseArrange"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim BookMK

Private Sub cmdAdd_Click()

If dataCourseSl.Recordset.RecordCount > 0 Then

    BookMK = dataCourseSl.Recordset.Bookmark
    
Else

    BookMK = Null
    
End If

dataCourseSl.Recordset.AddNew

'InEditMode = True

'ToggleEditMode

End Sub

Private Sub cmdCancel_Click()

dataCourseSl.UpdateControls

'InEditMode = False

'ToggleEditMode

If Len(BookMK) > 0 Then

dataCourseSl.Recordset.Bookmark = BookMK

ElseIf dataCourseSl.Recordset.RecordCount > 0 Then

dataCourseSl.Recordset.MoveFirst

End If

End Sub

Private Sub cmdDelete_Click()

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

If Msg = vbYes Then

dataCourseSl.Recordset.Delete

dataCourseSl.Recordset.MoveNext

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

    dataCourseSl.Recordset.MoveLast
    
End If

End If

End Sub

Private Sub cmdModify_Click()

If dataCourseSl.Recordset.EOF Then Exit Sub

BookMK = dataCourseSl.Recordset.Bookmark

dataCourseSl.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), "'", "")

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

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

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

txtCourseDate.Text = Replace(Trim(txtCourseDate.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 txtStudentName.Text = "" Then
     
      MsgBox "不存在这个学生!", , "学号输入错误"
    
      txtStudentID.SetFocus
      
      Exit Sub

End If

If txtCourseDate.Text = "" Then
     
     MsgBox "上课时间不能为空!", , "输入错误"
    
     txtCourseDate.SetFocus
    
      Exit Sub
End If

If txtClassRoom.Text = "" Then

    MsgBox "课室不能为空!"
    
    txtClassRoom.SetFocus
    
    Exit Sub

End If

'If Not txtStudentID.Locked Then
    
    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
    
    Msg = "学号[" & txtStudentID.Text & "] 和课程号[" & txtCourseID.Text & "]已经存在,不能重复。"
    
    MsgBox Msg
    
    txtStudentID.SetFocus
    
    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
    
    Msg = "学号[" & txtStudentID.Text & "] 和课程号[" & txtCourseID.Text & "]已经存在,不能重复。"
    
    MsgBox Msg
    
    txtStudentID.SetFocus
    
    Exit Sub

    End If
    
End If

dataCourseSl.UpdateRecord

'InEditMode = False

'ToggleEditMode

If Len(BookMK) > 0 Then

dataCourseSl.Recordset.Bookmark = BookMK

ElseIf dataCourseSl.Recordset.RecordCount > 0 Then

dataCourseSl.Recordset.MoveFirst

End If

End Sub

Private Sub Form_Load()

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

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

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

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



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

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

dataValid.Visible = False

dataValid.Visible = False



'dataCourseSl.Visible = False

dataCourse.Visible = False

dataStudent.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 + -