Solved

Email to all contacts in Access Database

Posted on 2014-04-10
12
773 Views
Last Modified: 2014-11-12
This question might be a little difficult and I have totally no idea how to do, please show me step by step if possible (I never done this before)
   How do I do if I want to send a email to all the people that I have in my database at the same time from a gmail account.  for example, right now I only have two people in the DB, but I will be adding more in the future, I want to go to my gmail account and send an email to everyone and I don't want to send one by one, is anyway to do that?  That I can do from my gmail and select all the email address from my database?  I attach my DB too
AFSCME.mdb
0
Comment
Question by:urjudo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
12 Comments
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 39992365
you can write vba code in the database to send emails to whoever you want.
0
 

Author Comment

by:urjudo
ID: 39992372
where I can start? do you have any example?
0
 
LVL 7

Assisted Solution

by:COACHMAN99
COACHMAN99 earned 100 total points
ID: 39992398
coding the whole app will take me too much time unfortunately, but the key functions are

you will need to add a reference to the Outlook object library - tools/references in the vba window.

Function SendEmail(RecipEmail As String, Subject As String, BBody As String, cc1 As String) As Boolean
  On Error GoTo err_SendEmail
  Dim olApp As Outlook.Application
  Dim oItem As Outlook.MailItem
  Dim tInterval As Integer, signature As String
  If RecipEmail <> "" Then
    SendEmail = False
    Set olApp = CreateObject("Outlook.Application")
    Set oItem = olApp.CreateItem(olMailItem)
    With oItem
      .To = RecipEmail & IIf(cc1 <> "", "; " & cc1, "")
      .Display   'to get signature for later use
      signature = Nz(DLookup("CurricCoordSignature", "tblPrograms_LOOKUP", "Prog_Num=" & Nz(Forms("frmMain").cboProgram, 0)), 0) '.Body
      .Subject = Subject
      .Body = BBody & vbCr & vbCr & signature
    End With
    If Nz(gAttach1, "") <> "" Then oItem.Attachments.Add (cAttachmentPath & gAttach1)
    oItem.Display

  End If
  SendEmail = True
exit_SendEmail:
  On Error Resume Next
  Set olApp = Nothing
  Set oItem = Nothing
  Exit Function
err_SendEmail:
  MsgBox "Error " & Err.Number & ", " & Err.Description & " Occurred in SendEmail after " & ErrorLine
  Resume exit_SendEmail
End Function
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 27

Accepted Solution

by:
MacroShadow earned 400 total points
ID: 39992809
I prefer CDO. Attached please find a sample.
AFSCME.mdb
0
 

Author Comment

by:urjudo
ID: 39994136
Hi Marcoshadow,  
Thank you so much for the example, but when I made change for the code such as add my real gmail address, password, it seems when I click the send email button, it does not do anything, may be I need to check any of the References?
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39994178
No need for references. Try placing a break point in the beginning of the code and step thru it, that way you can see what's happening.
0
 

Author Comment

by:urjudo
ID: 39994201
it stops at If rs.BOF <> rs.EOF, the error message is "re.EOF =<object variable or with block variable not set>"
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39994556
1. there is a typo: re.EOF instead of rs.EOF
2. add
rs.movelast
rs.movefirst

Open in new window


before the line that errs out.
0
 

Author Comment

by:urjudo
ID: 40005339
for some reason, it seems the button is still not doing anything  after i added the two lines and fixed the code, do i need to  change anything in the modules? such as the "username" & "password"?
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 40005354
Is there an error, if so, which and where?
0
 

Author Comment

by:urjudo
ID: 40005371
it still stop on the if rs.bof<>rs.eof , the same message that i mentioned before, even i already put my gmail address and password, that's i was wandering if i need to change anything in the module that states "username"and "password" to be the same as i have in the send email button code?
0
 

Author Closing Comment

by:urjudo
ID: 40007778
Thank you!!!!
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the encryption capabilities built into Google Apps and how these features can help you meet privacy policy and regulatory compliance, but are not a full solution. Understand and compare the most popular email encryption services for Google A…
Many of you may be aware of the recent Google Docs scam emails that have been floating around coming from various people that you know. Here's a guide on identifying How To Identify the Scam Email You will see an email from someone you’ve had co…
By using UNIQUE function in Google Sheets, you can get around removing duplicates like in Microsoft Excel.
This Micro Tutorial will demonstrate Google Calendar to monitor updates with top sites, such as Facebook, Google, Twitter, etc. with Marketing News. Each update of Google Calendar can be monitored, correlate dips and spikes in your website traffic, …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question