Connecting Tech Pros Worldwide Help | Site Map

Send Email from Access Using a custom Outlook Form

Mr T
Guest
 
Posts: n/a
#1: Aug 10 '06
I know how to send email from Access and I know how to create a custom
form in Outlook. but.... How do I put the email info from Access into
the Outlook custom form ???

Dim MyDB As Database
Dim MyRS As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheAddress As String

Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("Select * from tblMailingList Where
responded <>-1")
MyRS.MoveFirst

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")


Do Until MyRS.EOF
' Create the e-mail message.

Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheAddress = MyRS![emailaddress]
If MyRS!responded <-1 Then


With objOutlookMsg
' Add the To recipients to the e-mail message.
Set objOutlookRecip = .Recipients.Add(TheAddress)
objOutlookRecip.Type = olTo



If TheAddress = "Joe.Blow@somewhere.com" Then

.Subject = "Only " & [daysleft] & " Days Left Till Your
Report Is Due !"
.Body = " John," & _
"You have " & [daysleft] & " days remaining to
submit the your updates!"
.Importance = olImportanceHigh


Else

' Set the Subject, the Body, and the Importance of the e-mail
message.
.Subject = "***MANDATORY RESPONSE REQUIRED***"



.Body = "BLAH BLAH BLAH BLAH" & _
"Thank you for help."
.Importance = olImportanceHigh 'High importance

'Resolve the name of each Recipient.
End If

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next

.Display
'.Send
End With


End If
MyRS.MoveNext

Loop

Set objOutlookMsg = Nothing
Set objOutlook = Nothing


End Sub

Suggestions ???

pietlinden@hotmail.com
Guest
 
Posts: n/a
#2: Aug 10 '06

re: Send Email from Access Using a custom Outlook Form



Mr T wrote:
Quote:
I know how to send email from Access and I know how to create a custom
form in Outlook. but.... How do I put the email info from Access into
the Outlook custom form ???
>
Suggestions ???
Sure. Check the Outlook NG. Essentially what you're saying is that
"this is an Outlook problem". It's not that I'm trying to put you off,
but the likelihood of finding someone who knows enough about Outlook
forms to help you in that NG is much higher than it is here.

Closed Thread


Similar Microsoft Access / VBA bytes