Link to home
Start Free TrialLog in
Avatar of Sivasan
SivasanFlag for United States of America

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sivasan

ASKER

Thanks a million