Senin, 07 Mei 2012

Re: [AccessDevelopers] Re: Emailing From Access

 

Jay

Here is my process. I do not know if this is what you are looking for or not. 

Jim

Here is the vba code that I use for the emailing of reports I changed all names to protect the innocent. 




'                                                       ER111
'                                                       Jim's Department
Function SendAnEmailER111()
Dim objol As New Outlook.Application
Dim objmail As MailItem
Set objol = New Outlook.Application
Set objmail = objol.CreateItem(olMailItem)
With objmail
.To = DLookup("EmailAddress", "tblAccounts", "DeptCode = ' ER111 '")
.Subject = "Monthly Report for" & " " & DLookup("[DepartmentName]", "tblAccounts", "DeptCode = ' ER111 '") & " " & DLookup("[DeptCode]", "tblAccounts", "DeptCode = ' ER111 '")
.Body = "Hello." & " " & DLookup("[DepartmentName]", "tblAccounts", "DeptCode = ' ER111 '") & "," & " Attached is your department's monthly report. If you have any questions, please contact the  Team.     Thank You."
.NoAging = True
.Attachments.Add ("Use Your Own Path Here\Department Reports\ ER111 .pdf")
.Display
End With
Set objmail = Nothing
Set objol = Nothing
SendKeys "%{s}", True
End Function


I create a table named tblAccounts with the following fields based on my needs.

DepartmentName
DeptCode
EmailAddress

Because of my needs I create a macro that runs the reports. because there are so many it is a macro. 
The macro  has these lines in it

OpenReport
OpenReport where the filter is based on the dept code
exportwithformatting export the report to a folder
Runcode * put the function here like SendAnEmailER111 () 
 
Jim Wagner


From: Jay Beckham <jay@thebeckhams.us>
To: AccessDevelopers@yahoogroups.com
Sent: Saturday, May 5, 2012 9:14 PM
Subject: RE: [AccessDevelopers] Re: Emailing From Access

 
Thanks Jim, and I need to go to bed also.
 
Jay Beckham
"Doing what you love is Freedom. Loving what you do is Happiness"
From a Chinese Fortune Cookie
 
 
From: AccessDevelopers@yahoogroups.com [mailto:AccessDevelopers@yahoogroups.com] On Behalf Of Jim Wagner
Sent: Sunday, May 06, 2012 12:09 AM
To: AccessDevelopers@yahoogroups.com
Subject: Re: [AccessDevelopers] Re: Emailing From Access
 
 
Jay,
 
I have some code on a database at work that would work great. I can send it to you on Monday. I need to go to bed now. I have been up since about 4:30 am
 
Jim Wagner

 

From: Jay Beckham <jay@thebeckhams.us>
To: AccessDevelopers@yahoogroups.com
Sent: Saturday, May 5, 2012 8:44 PM
Subject: RE: [AccessDevelopers] Re: Emailing From Access
 
 
I could use either I guess.  Just my version of Outlook doesn't match what the Access version is looking for.  I would certainly have more control with VBA I imagine.
 
What I am trying to do is to run a query on my client database, and email the clients selected by the query with a particular advertising email or in the case of a group, informational email about that group.
 
Jay Beckham
"Doing what you love is Freedom. Loving what you do is Happiness"
From a Chinese Fortune Cookie
 
 
From: AccessDevelopers@yahoogroups.com [mailto:AccessDevelopers@yahoogroups.com] On Behalf Of Jim Wagner
Sent: Saturday, May 05, 2012 11:20 PM
To: AccessDevelopers@yahoogroups.com
Subject: Re: [AccessDevelopers] Re: Emailing From Access
 
 
Jay
 
what are you using to send the emails? macro? vba?
 
Jim Wagner

 

From: Jay <jay@thebeckhams.us>
To: AccessDevelopers@yahoogroups.com
Sent: Saturday, May 5, 2012 8:08 PM
Subject: [AccessDevelopers] Re: Emailing From Access
 
 

I wrote this email this afternoon and it is still here and not delivered. Wonder what is happening again with Yahoo Groups.

Jay Beckham

--- In AccessDevelopers@yahoogroups.com, "Jay" <jay@...> wrote:
>
> I am using MS Access 2007. I have a database with email addresses in clients records. I also have Outlook 2010. When I try and create an email it says I need Outlook 2007.
>
> Is there another way to send emails?
>
> Thanks
>
> Jay Beckham
> Cruises On The Sea.
>
 
 


__._,_.___
Recent Activity:

Please zip all files prior to uploading to Files section.
.

__,_._,___

Tidak ada komentar:

Posting Komentar