?
Solved

Command button event to export access query to excel and attach to email

Posted on 2013-02-04
2
Medium Priority
?
2,336 Views
Last Modified: 2013-02-04
Hi There,
I have form in access. I have a button on the form on click I export the result of a query in access to excel. I like to know if instead of saving it, if I can directly attach the excel as an attachment to a email to be send via outlook.
Code to export to excel

the on click event

Dim stDocName As String
Dim stLinkCriteria As String

'Export report to MS Excel
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "OrderviewQry", "C:\Temp\OrderReport.xls"
DoCmd.Beep

MsgBox "The Selected Orders will be exported to Excel and saved in"
------------------

thanks
S
0
Comment
Question by:Sivasan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 2000 total points
ID: 38853236
Look at Sendoject in Help...example..


docmd.SendObject acSendQuery,"OrderviewQry",acformatxls,"xyz@abcd.com",,,"Subjectline"
0
 

Author Closing Comment

by:Sivasan
ID: 38853291
Thanks a million
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question