How to access the report toolbar programmatically in MS-Access 97
I have a project in Access 97 that I have to add the ability to export a report to excel. When you run the report within the program there is already the ability to export to word and to excel though the excel only some of the headers.
Through research I found that I might be able to get it to work using OutputTo but unfortuneately I can't attempt this because I am unable to find the code for the toolbar in the report view. I found the actual report. I have never used Access of any version so do I just need to add a macro or do I have to approac开发者_高级运维h this a different way? I can't find where the code is already located.
either use a macro with the TransferSpreadsheet action, or export it with VBA code like this:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, sQryExport, sPath & "\xls\" & sPrefix & sRptGroup & ".xls"
DoCmd.OpenReport "rpt_summary", acViewPreview, , "reportGroupID='" & sRptGroup & "'", acHidden
DoCmd.OutputTo acOutputReport, "rpt_summary", "Rich Text Format (*.rtf)", sPath & "\rtf\" & sPrefix & sRptGroup & ".rtf"
DoCmd.Close acReport, "rpt_summary"
精彩评论