Results 1 to 4 of 4
  1. #1
    nickblitz is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    21

    how to send email in access 2010

    ok, this code below is working but it does not show a pop up from outlook instead it sends the mail automatically.



    I want to have a pop up as a new email message with the to list populated from the query when i click the button on the form. anyone can help?

    Code:

    Dim MyDb As DAO.Database
    Dim rsEmail As DAO.Recordset
    Dim strEmailAddress

    Set MyDb = CurrentDb()
    Set rsEmail = MyDb.OpenRecordset("Query Full Director", dbOpenSnapshot)

    Do Until rsEmail.EOF strEmailAddress = strEmailAddress & rsEmail("Email") & ";"
    rsEmail.Move
    NextLoop
    strEmailAddress = Left(strEmailAddress, Len(strEmailAddress) - 1)
    DoCmd.SendObject , , acFormatRTF, strEmailAddress, _, , strSubject, strEMailMsg, False, False
    rsEmail.CloseSet
    rsEmail = Nothing

  2. #2
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    I assume Outlook is your mail client. I don't know of any way except through Office Automation. That is open an Outlook session, create an email, add subject, add email body, add addresses and stop. You may then review the email before you send it.

    If you want to pursue this I can help.

  3. #3
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480
    Above is my code... I use the .Display option to make the outlook email visible.

    Seems the options of Docmd.sendobject might be indeed, sending the object.. Is createobject an option? Either way take a look above I hope it helps.


    Code:
    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)         
    
     ''' Assigning things in the outlook mail message.   ' This example will populate the email based on form txtboxes.    
    
    With objMail        
    .Subject = Forms("Formname").txtboxname        
    .Body = Forms("Formname").txtboxname        
    .To = Forms("Formname").txtboxname        
    .Display        
    .ReadReceiptRequested = True  'IF you want to enforce a read receipt, keep this part, if not just comment or remove it      End With  End Sub

  4. #4
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Redbull: Reminder to include the reference to the Outlook object model!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 05-29-2012, 02:10 PM
  2. How can I send an email from access???
    By Asma in forum Programming
    Replies: 2
    Last Post: 12-07-2011, 07:49 AM
  3. VBA to Send email from Access
    By ped in forum Access
    Replies: 3
    Last Post: 08-11-2011, 05:37 PM
  4. Send email from Access DB Table
    By skaswani in forum Programming
    Replies: 3
    Last Post: 12-18-2010, 04:23 PM
  5. Send email from Access thru Outlook
    By ZMAN in forum Forms
    Replies: 2
    Last Post: 11-27-2010, 06:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums