PDA

View Full Version : [SOLVED:] DoCmd.OutputTo works in .adp file but not .accdb file



cleteh
04-25-2017, 12:59 PM
I am rebuilding a database as a .accdb file instead of .adp file so it will work in Access 2013 and I get a Property not found error on this line trying to transfer results from a view into an excel file. This code works in the .adp file.

'Export the open issues query results (created view in SQL server)

[CODE]DoCmd.OutputTo acOutputServerView, "dbo.Issue Open 3", "ExcelWorkbook(*.xlsx)", "I:\Groups\ccuser\Finance\Collection Control\Open Issues\OpenIssuesReport.xlsx", False, "", , acExportQualityPrint[CODE]

HiTechCoach
04-25-2017, 09:46 PM
Try changing "ExcelWorkbook(*.xlsx)" to acFormatXLS



DoCmd.OutputTo acOutputServerView, "dbo.Issue Open 3", acFormatXLS, "I:\Groups\ccuser\Finance\Collection Control\Open Issues\OpenIssuesReport.xls", False, "", , acExportQualityPrint

HiTechCoach
04-25-2017, 09:49 PM
You might also want to look into using the DoCmd.TrasferSpreadsheet

PhilS
04-26-2017, 01:32 AM
The ObjectType acOutputServerView is only available in ADP-Projects. You need to either link the view to your Access database as a table or create a local query replicating the view. Then use the ObjectType acOutputTable or acOutputQuery.

cleteh
04-26-2017, 12:25 PM
Thanks Phil, I did find that I need to link my views located in SQL Server