I have been trying to set up a routine that makes reports based on a form. I have a macro that ques the reports. This works great for printing, but not for emailing
With the reports I want to email them to a customer. This works fine with one report but when I have more then one it only sends the last report. I was looking at printing to a file but all I get is junk.
I have attached my code. This code is set to an event procedure on my form. I know not very elagent but I'm not a pro at this. Any help would be appreciated.
I'm using Access 2003
Thanks
Rich De Gray
_______________________________________________________________
Private Sub cmdEmailReports_Enter()
On Error GoTo cmdEMailReports_Click_Err
Dim strMsg As String
Dim strTitle As String
Dim intStyle As Integer
Dim StrCriterion As String
Dim strMailto As String
Dim strDocName As String
Dim strMessage As String
'This forces the record to be saved.
If Me.Dirty Then
Me.Dirty = False
End If
'Me.Visible = False
StrCriterion = "[Customer Id]=" & Me![Customer ID]
DoCmd.RunMacro "Marketing Proposal"
strMessage = "Attached is our proposal we discussed"
'This will minimize the report, whilst the e-mail in being prepared, I have tried not to have it open in preview but
'cannot get it to work.
DoCmd.Minimize
strMailto = Forms!Marketing.
strDocName = "M C Client Cover Letter"
strDocName = "M C Client Welcome"
strDocName = "M C Lease What To Send"
strDocName = "M C Mission Statement"
strDocName = "M C Proposal Fee Explanation"
strDocName = "M C Proposal Procedures"
strDocName = "M C Proposal References"
strDocName = "M C Worthless Checks"
strDocName = "M C Agreement"
strDocName = "M C Set Up Invoice"
'This will create the e-mail
DoCmd.SendObject acReport, strDocName, "RichTextFormat(*.rtf)", strMailto, "", "", "Credit Management Services Of Georgia, LLC.", strMessage, True, """"
'This will close the report when you either cancel or send the e-mail. The Frm_Customer will open
DoCmd.Close acReport, "C Client Cover Letter"
cmdEMailReports_Click_Exit:
Exit Sub
cmdEMailReport_Click_Err:
MsgBox Error$
Resume cmdEMailReports_Click_Exit
End Sub
With the reports I want to email them to a customer. This works fine with one report but when I have more then one it only sends the last report. I was looking at printing to a file but all I get is junk.
I have attached my code. This code is set to an event procedure on my form. I know not very elagent but I'm not a pro at this. Any help would be appreciated.
I'm using Access 2003
Thanks
Rich De Gray
_______________________________________________________________
Private Sub cmdEmailReports_Enter()
On Error GoTo cmdEMailReports_Click_Err
Dim strMsg As String
Dim strTitle As String
Dim intStyle As Integer
Dim StrCriterion As String
Dim strMailto As String
Dim strDocName As String
Dim strMessage As String
'This forces the record to be saved.
If Me.Dirty Then
Me.Dirty = False
End If
'Me.Visible = False
StrCriterion = "[Customer Id]=" & Me![Customer ID]
DoCmd.RunMacro "Marketing Proposal"
strMessage = "Attached is our proposal we discussed"
'This will minimize the report, whilst the e-mail in being prepared, I have tried not to have it open in preview but
'cannot get it to work.
DoCmd.Minimize
strMailto = Forms!Marketing.
strDocName = "M C Client Cover Letter"
strDocName = "M C Client Welcome"
strDocName = "M C Lease What To Send"
strDocName = "M C Mission Statement"
strDocName = "M C Proposal Fee Explanation"
strDocName = "M C Proposal Procedures"
strDocName = "M C Proposal References"
strDocName = "M C Worthless Checks"
strDocName = "M C Agreement"
strDocName = "M C Set Up Invoice"
'This will create the e-mail
DoCmd.SendObject acReport, strDocName, "RichTextFormat(*.rtf)", strMailto, "", "", "Credit Management Services Of Georgia, LLC.", strMessage, True, """"
'This will close the report when you either cancel or send the e-mail. The Frm_Customer will open
DoCmd.Close acReport, "C Client Cover Letter"
cmdEMailReports_Click_Exit:
Exit Sub
cmdEMailReport_Click_Err:
MsgBox Error$
Resume cmdEMailReports_Click_Exit
End Sub