Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with simple VBA code that emails to single address

Status
Not open for further replies.

SSAMarvel

IS-IT--Management
Jun 28, 2010
5
0
0
US
I have a Database that logs and stores work orders. This is a very simple tool that allows users to submit a work order by using a form. On this form I currently have a macro linked to a button that emails the new work order to a joint email account in outlook. Due to having to leave the trust settings in access on allow all macros I am tring to build this macro action in VBA. So far everything I have seen is more complex than what I need. I need simple when click "button" "email" this "report" to "here". If someone can help me with this I would be willing to give a great big atta boy or girl.
 
Have a look at the DoCmd.SendObject method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the lead on the DoCmd.SendObject. I was able to get close but keep snagging saying that object does not exist or is misspelled. Here is what I have so far


Private Sub Email_Click()

DoCmd.SendObject acSendReport, "[New Work Order Report]", acFormatXLS, _
"emailaddress", , , _
"[Subject]", "[Message]", True, True

End Sub
 
I got it to work thank you for the lead once again. The code that worked was

Private Sub Email_Click()
Dim stDocName As String

stDocName = "New Work Order Report"

DoCmd.SendObject acReport, stDocName, acFormatXLS, _
"emailaddress", , , _
"subject", "message", True, False

End Sub

Of course this was more than likly an easy thing to do im just a novice. Thanks again for the lead I need all the help I can get.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top