how do I code message send options for voting priority category?

J

JC

the following works- need message send options for importance, voting, category
based on criteria if approver > 2000 then go to name

Private Sub CMDSendEmail1_Click()
On Error GoTo Err_cmdSendEmail1_Click

Dim strEmailMessage As String
Dim strCC As String
Dim StrRcvdDate As String
Dim strDueDate As String
Dim StrSubject As String
Dim StrImportance As String


StrRcvdDate = Forms![Data FORM].Form![DateReceived]
'the due date for signoff

'the text of the message, use chr(10) for line breaks
strEmailMessage = "Please review the attached document, Approve or
Reject BY Email. Please email Medco Finance Contracts Admin the revised
Form." & Chr(10) & Chr(10) & "Thank You!" & Chr(10) & Chr(10) & "Adjustment
Administrator"

strCC = "Medco Finance Contracts Admin"
'the email address of all ccs
strBCC = ""
'the email address of all bccs
StrSubject = "Manual Billing Request. Adjustment Form"
'the subject of the email
'strTo = Forms![DataForm]![Form1].Form![UserID]
'the recipient of the email
strAttachment = "DATA RPT"
'the name of the attached report
StrImportance = "High" 'High importance

'"1"

DoCmd.SendObject acSendReport, strAttachment, "SnapshotFormat(*.snp)",
strTo, strCC, strBCC, StrSubject, strEmailMessage, True, ""

If Forms![Data FORM].Form![SaveReport] = -1 Then
DoCmd.RunMacro "SaveReport"
End If

Exit_cmdSendEmail1_Click:

Exit Sub

Err_cmdSendEmail1_Click:
MsgBox Err.Description
Resume Exit_cmdSendEmail1_Click



End Sub
 
E

Eric Legault [MVP - Outlook]

Hi JC. The SendObject command in Access only facilitates basic Outlook
integration. To set values on additional message properties you need to use
the Outlook Object Model directly. Here's a quick example:

Sub CreateHTMLMail()
'Creates a new e-mail item and modifies its properties

Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)

With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><H2>The body of this message will appear in
HTML.</H2><BODY>Please enter the message text here. </BODY></HTML>"
.Display
End With

End Sub

Use the Attachments collection and Importance and Categories properties to
set other values as per what you are trying to do. Don't forget to set a
reference to the Outlook Object Model in the References dialog in the Access
VBA editor.

This resource will help also:

Microsoft Access Email FAQ - Outlook:
http://www.granite.ab.ca/access/email/outlook.htm

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


JC said:
the following works- need message send options for importance, voting, category
based on criteria if approver > 2000 then go to name

Private Sub CMDSendEmail1_Click()
On Error GoTo Err_cmdSendEmail1_Click

Dim strEmailMessage As String
Dim strCC As String
Dim StrRcvdDate As String
Dim strDueDate As String
Dim StrSubject As String
Dim StrImportance As String


StrRcvdDate = Forms![Data FORM].Form![DateReceived]
'the due date for signoff

'the text of the message, use chr(10) for line breaks
strEmailMessage = "Please review the attached document, Approve or
Reject BY Email. Please email Medco Finance Contracts Admin the revised
Form." & Chr(10) & Chr(10) & "Thank You!" & Chr(10) & Chr(10) & "Adjustment
Administrator"

strCC = "Medco Finance Contracts Admin"
'the email address of all ccs
strBCC = ""
'the email address of all bccs
StrSubject = "Manual Billing Request. Adjustment Form"
'the subject of the email
'strTo = Forms![DataForm]![Form1].Form![UserID]
'the recipient of the email
strAttachment = "DATA RPT"
'the name of the attached report
StrImportance = "High" 'High importance

'"1"

DoCmd.SendObject acSendReport, strAttachment, "SnapshotFormat(*.snp)",
strTo, strCC, strBCC, StrSubject, strEmailMessage, True, ""

If Forms![Data FORM].Form![SaveReport] = -1 Then
DoCmd.RunMacro "SaveReport"
End If

Exit_cmdSendEmail1_Click:

Exit Sub

Err_cmdSendEmail1_Click:
MsgBox Err.Description
Resume Exit_cmdSendEmail1_Click



End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top