Results 1 to 6 of 6
  1. #1
    srcacuser is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Northern Virginia
    Posts
    15

    Emails with a Macro

    Hello,
    I currently have a Macro called by a "save/email" button. This macro will email (EmailDatabaseObject) the current form out to several users as a .pdf. In design view of this macro, there were only a few items available.
    Object Type, Object Name, Output Format, Subject, Message Text, etc.



    Is it possible somehow to modify this macro to include the current record number or another field? So the email recipients wouldn't have to open up the .pdf? For example, the message text of the
    email would include "09012A0000". Or, the .pdf attachment would be the name of the record? It seems code would be involved, if this is possible at all.

    Thanks in advance

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    I would use code, but you can try something like this in the macro:

    "Your message text " & Forms!FormName.TextboxName & " more text here"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    srcacuser is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Northern Virginia
    Posts
    15
    Thans for replying Paul.
    Where do I do this? In the design view, it doesn't appear to take code in the lines.?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    I just did a brief test and it doesn't appear that the macro will resolve the form reference. If you switch to VBA code, you can definitely do it there:

    DoCmd.SendObject , , , "blah@test.com", , , "subject", "test " & Forms!form1.Text16 & " whatever", True

    If you're not sure where to place VBA code:

    http://www.baldyweb.com/FirstVBA.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    srcacuser is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Northern Virginia
    Posts
    15
    There is an option to "convert to Macro", and that gives me a VB window. But none of the code that's added will then save to that macro. It reverts back to the former.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Converting the macro was a one way trip.

    You want to use VBA instead of the macro to do what you're trying to do. It doesn't appear that the macro can resolve the form reference in the message.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Sending multiple emails
    By Petefured in forum Programming
    Replies: 0
    Last Post: 05-24-2011, 03:40 AM
  2. Automatic Emails
    By smit2215 in forum Queries
    Replies: 1
    Last Post: 03-10-2011, 01:23 PM
  3. Access emails
    By Gargen in forum Access
    Replies: 5
    Last Post: 08-04-2010, 01:10 PM
  4. Automatic emails.
    By motherboard in forum Queries
    Replies: 3
    Last Post: 05-04-2010, 11:03 AM
  5. Emails from Access
    By dbn00bz in forum Access
    Replies: 0
    Last Post: 12-07-2009, 07:55 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