If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord
'send copy of feedback to tutor by email
Dim TutorEmail As String
Dim FeedBackMail As String
Dim msg As String
Dim subj As String
Dim r As Long
Dim EmailToStudent As Boolean
If Nz(Me![Primary Email], "") <> "" And Me![Feedback Method] = "Email"
Then
EmailToStudent = True
Else
EmailToStudent = False
End If
If EmailToStudent Then
msg = "Would you like to email the student"
msg = msg & vbNewLine
msg = msg & "or print preview the report?"
msg = msg & vbNewLine & vbNewLine
msg = msg & "Yes to email them"
msg = msg & vbNewLine
msg = msg & "No to print preview"
msg = msg & vbNewLine
msg = msg & "or cancel"
r = MsgBox(msg, vbYesNoCancel + vbQuestion, "Email to Student")
Select Case r
Case vbYes
EmailToStudent = True
Case vbNo
EmailToStudent = False
Case vbCancel
GoTo btnFeedbackScores_Click_exit
End Select
End If
If EmailToStudent Then
msg = "Hi " & Nz(Me![Nickname], Me![Forename]) & ","
msg = msg & vbNewLine & vbNewLine
msg = msg & "You will find attached the marks & feedback for module "
& Me![cboModule] & " which you submitted recently."
msg = msg & vbNewLine & vbNewLine
msg = msg & "This message has been sent from the Administration
offices. If you have and comments or wish to discuss the feedback please
contact your tutor, and not the office. Your tutor will have been sent a
copy of this message. "
msg = msg & vbNewLine & vbNewLine
msg = msg & vbNewLine & vbNewLine
msg = msg & "The attached file is in Microsoft Snapshot format, and if
you have Microsoft Access installed on your computer you should be able to
read the file. However, if it is not installed, or you are having any
difficulty in opening or reading the file, please go to the Student
Resources Area of the xxx web site where you will be able to download the
snapshop viewer free of charge."
msg = msg & vbNewLine & vbNewLine
msg = msg & vbNewLine & vbNewLine
msg = msg & vbNewLine & vbNewLine
msg = msg & "Administration Team"
subj = "Feedback for Module " & Me![cboModule]
DoCmd.SendObject acSendReport, "rptStudentMarkingFeedbackLetter",
"Snapshot Format (*.snp)", Me![Primary Email], , , subj, msg, True
Else
DoCmd.OpenReport "rptStudentMarkingFeedbackLetter", acViewPreview, , ,
acDialog
End If
Me![StuModFeedbackSentOn] = Now()
TutorEmail = Nz(DLookup("
", "tblTutors", "[TutorID] = """ &
Me![Student Tutor] & """"), "")
FeedBackMail = Me![cboModule] & "[email protected]
If TutorEmail = "" Then
msg = "I can't send a copy to the tutor" & vbNewLine
msg = msg & Me![Student Tutor] & " has no email address on file."
MsgBox msg, vbInformation + vbOKOnly, "Tutor Email Cancelled"
GoTo btnFeedbackScores_Click_exit
Else
msg = "Hi " & DLookup("[Forename]", "tblTutors", "[TutorID] = """ &
Me![Student Tutor] & """") & ","
msg = msg & vbNewLine & vbNewLine
msg = msg & "You will find attached a copy of the moderated feedback
for:"
msg = msg & vbNewLine & vbNewLine
msg = msg & "Student: " & Me![cboStudent].Column(1)
msg = msg & vbNewLine
msg = msg & "Module: " & Me![cboModule]
subj = "Moderated Feedback: " & Me![cboModule] & " - " &
Me![cboStudent].Column(1)
DoCmd.SendObject acSendReport,
"rptStudentAssignmentFeedbackDetailsCCtoTutor", "Snapshot Format (*.snp)",
TutorEmail, FeedBackMail, , subj, msg, True
End If
btnFeedbackScores_Click_exit:
On Error Resume Next
Exit Sub
btnFeedbackScores_Click_error:
Select Case Err
Case 2501 'action cancelled
Resume Next
Case Else
MsgBox Err & " - " & Error$, vbCritical + vbOKOnly, "Error in
btnFeedbackScores_Click"
Resume btnFeedbackScores_Click_exit
End Select
End Sub