Private Sub cmdLetter1_Click()
'Send a message if tickbox is already ticked
On Error GoTo PROC_ERR
If CheckLetter1 = True Then
MsgBox "The tickbox is ticked which indicates that a letter or email has been sent." _
& Chr(13) & "If you wish to send another please untick the box. ", vbOKOnly, Warning
End If
PROC_ERR:
MsgBox "Error: (" & Err.Number & ") " & Err.Description, vbCritical
End
'Check whether to email or post
Email.SetFocus
'Stop error if email isnt sent
On Error GoTo Error
'Email
If Email.Text <> "" Then
SendEmail 'Function
Error:
Resume Next
Else
'Post
'Had to use this routine to make the report print in colour
Dim stDocName As String
stDocName = "rptCustLetter1"
DoCmd.OpenReport stDocName, acViewPreview
With Reports(rptCustLetter1).Printer
.ColorMode = acPRCMColor
End With
'end of colour enforcement
DoCmd.OpenReport "rptCustLetter1", acViewNormal
DoCmd.Close
End If
'Tick to indicate letter is sent
SentStage1 = Date
CheckLetter1.Value = True
Calculator 'Function
DoCmd.Restore
End Sub