By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,668 Members | 1,552 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,668 IT Pros & Developers. It's quick & easy.

Send Email from Access Using a custom Outlook Form

P: n/a
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 = "Jo******@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 ???

Aug 10 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Mr T wrote:
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.

Aug 10 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.