Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

Access VBA - send query

Hi

How do I update the following code so that the query gets sent in the body of the email.
Also it doesn't get sent automatically. I have to  press the send button. I don't want to have to.
Sub SendDatesEntered(ByVal sEmail As String)
On Error GoTo EH
    
    DoCmd.SendObject acSendQuery, "Dates Entered in Performance", acFormatPDF, sEmail, "graham@ses-sa.co.za", "admin@macros-vba.com", "Lesedi Performance dates entered", "These are the dates entered into the Performance database", , True
Exit Sub
EH:
   'MsgBox "There was an error sending a report " & Err.Description


End Sub

Open in new window

0
Murray Brown
Asked:
Murray Brown
  • 3
1 Solution
 
Jeffrey CoachmanCommented:
To send the email automatically:

DoCmd.SendObject acSendQuery, "Dates Entered in Performance", acFormatPDF, sEmail, "graham@ses-sa.co.za", "admin@macros-vba.com", "Lesedi Performance dates entered", "These are the dates entered into the Performance database", , False

...But the help files on the SendObject Method explains all of these options...


Embedding the query IN the body of the email takes a bit more work.
I'm at the office now, I am sure another Expert can help with that portion of your Q

;-)

JeffCoachman
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much Jeff
0
 
Jeffrey CoachmanCommented:
;-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now