Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub cmdAddPoints_Click()
- Dim RSAddPoints As Recordset
- Dim MyAnswer As String
- MyAnswer = MsgBox("Do you wish to add/remove " & Me.txtNoOfPoints & " points to the student ID " & Me.txtStudentID & "?" _
- , vbYesNo)
- If MyAnswer = vbYes Then
- Set RSAddPoints = CurrentDb.OpenRecordset("tblPoints", dbOpenDynaset)
- RSAddPoints.AddNew
- RSAddPoints!StudentID = Me.txtStudentID
- RSAddPoints!StaffID = Me.txtStaffID
- RSAddPoints!Reason = Me.cmbReason
- RSAddPoints!NumberOfPoints = Me.txtNoOfPoints
- RSAddPoints!DateOfPointChange = Me.txtDate
- RSAddPoints.Update
- RSAddPoints.MoveLast
- Dim RSStudent As Recordset
- Set RSStudent = CurrentDb.OpenRecordset("tblStudent", dbOpenDynaset)
- RSStudent.MoveFirst
- Do While Not RSStudent.EOF
- If Me.txtStudentID = RSStudent!StudentID Then
- RSStudent!TotalPoints = RSStudent!TotalPoints + Me.txtNoOfPoints
- RSStudent.Update
- Exit Do
- Else
- RSStudent.MoveNext
- End If
- Loop
- MsgBox (Me.txtNoOfPoints & " points were added to the Student ID " & Me.txtStudentID)
- Me.txtStudentID = ""
- Me.txtStaffID = ""
- Me.cmbReason = ""
- Me.txtNoOfPoints = ""
- Me.txtDate = ""
- Else
- End If
- End Sub
Add Comment
Please, Sign In to add comment