Results 1 to 15 of 15
  1. #1
    Rico is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Perth Australia
    Posts
    29

    Post Email not being sent in VBA

    I am trying to sent an attached table with an email, but the email is not being sent, and I am not getting an error message.


    I have a button on a form, when pressed, the following line of code activates.

    DoCmd.SendObject acSendTable, "TestTable", acFormatRTF, "rwshea220540@gmail.com", , , "Test", "Sending an email from VBA"

    The table contains just 3 names in 3 records: Fred Alan Mark
    Can you tell me what is wrong with this setup.
    Thanks Rico

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    It should open email for editing.

    Works for me.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Rico is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Perth Australia
    Posts
    29
    Sorry June7, I am not sure what you have sent me, I am NOT trying to send an attached file to accessforums.
    I have an access program that allows the residents in my village to book appointment times for the visiting doctor.
    I then have a button on the form to allow the manager of our village to email that list to the doctors address.
    Rico

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    5,007
    Quote Originally Posted by Rico View Post
    Sorry June7, I am not sure what you have sent me, I am NOT trying to send an attached file to accessforums.
    I have an access program that allows the residents in my village to book appointment times for the visiting doctor.
    I then have a button on the form to allow the manager of our village to email that list to the doctors address.
    Rico
    What June is saying I believe, is that the code works for her?
    I have just tested it and it opens an email with the table attached and email address in place. If I add False at the end, I get a warning that a program is trying to send an email, if I allow, it still works.

    Ah I see now,
    That sentence about attaching a file is the signature. See mine, all below the line.

    Possibly try a repair of Office?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    Rico is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Perth Australia
    Posts
    29
    Now I am really confused, Welshgasman, what does this mean?
    Ah I see now,
    That sentence about attaching a file is the signature. See mine, all below the line.

    I have used False and True without any success, the email is just not being sent. Thanks Rico

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    You can build a 'signature' to show at the bottom of each of your posts. The signature is below the thin line at bottom of post. I did not send you anything. What you read was my signature that shows at the bottom of all my posts. My signature has instruction on how to attach files to posts. Welshgasman also has a signature with some links.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    5,007
    Quote Originally Posted by Rico View Post
    Now I am really confused, Welshgasman, what does this mean?
    Ah I see now,
    That sentence about attaching a file is the signature. See mine, all below the line.

    I have used False and True without any success, the email is just not being sent. Thanks Rico
    This
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

    is June7's signature.

    This
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
    is mine

    You are confusing a signature as being part of the reply, which it is not. It is the same for any reply.

    No idea as why it does not work for you, but does for June7 and myself.?
    Try an office repair as I have already suggested?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    Shadow9449 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Feb 2017
    Posts
    38
    Rico:

    SendObject uses whatever default email program you are using with Windows on that computer. Which email program are you using and are you sure it's registered with Windows as the default?

  9. #9
    Rico is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Perth Australia
    Posts
    29
    I have run office update and taken the latest version, compacted and repair, run it on my wife's PC, determined that MS Mail is my default email program - all with no success.
    I do not have any problems sending emails from this PC or receiving emails to rwshea220540@outlook.com on this PC.
    I have tried - DoCmd.SendObject , , , "rwshea220540@outlook.com", , , "Test", "Sending an email from VBA"
    I am sure it worked for me in a project I wrote a few years ago. (lost track of that one).
    It seems such a simple problem that you blocks must have run into before.
    Could it have something to do with setting references?? (still hopeful, Rico)

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    My default email is MSMail but SendObject still opens Outlook email window.

    Do you have Outlook installed?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    just a thought - have you checked your drafts folder? perhaps the email is sitting there?

  12. #12
    Rico is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Perth Australia
    Posts
    29
    CJ_London, Drafts, JunkMail and Deleted items are all empty, thanks anyway.
    June7, YES YES YES you are definitely on the right track with "Do you have Outlook installed?", I think it was installed but not loaded, when loaded they all came thru.
    I will continue testing and let you know how I go.
    Rico

  13. #13
    Rico is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Perth Australia
    Posts
    29
    Ok, I think I am beginning to understand my problem. Every body gets ms mail with win 10 but only those who pay for 365 get outlook.
    I had 365 outlook installed on my pc but it was not loaded. Now my --- DoCmd.SendObject , , , "rwshea220540@outlook.com", , , "Test", "Sending an email from VBA" --- are coming thru to outlook but NOT ms mail.
    The problem is I am TESTING to myself. If the doctor I am emailing to only has ms mail and not 365 outlook, he is not going to get them.
    Is it possible for
    DoCmd.SendObject to send to ms mail. Thanks, Rico

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    It shouldn't matter what email app the recipient uses. Outlook sends to an email account. Recipient can set up whatever app they want to view mail from that account.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    Rico is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    Perth Australia
    Posts
    29
    Ok, I think I am finished picking your brains.
    If i am using access to send an email, then I have obviously got Outlook because it comes with 365 office pack.
    And once it's installed, it doesn't have to be loaded (that was my mistake).
    And I don't think that the address that I am sending the email to, (needs to have 365 office installed) to receive my email in their ms mail. (although I have not had a chance to test that, as all of my testing pc's have 365 office installed).
    Forever grateful, Rico

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

Similar Threads

  1. Replies: 7
    Last Post: 08-01-2017, 06:38 PM
  2. Replies: 2
    Last Post: 05-23-2016, 01:28 PM
  3. Replies: 3
    Last Post: 12-28-2015, 04:11 PM
  4. Replies: 5
    Last Post: 05-07-2014, 09:25 AM
  5. Replies: 1
    Last Post: 05-01-2014, 11:37 AM

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