Module Exporting Mutliple Queries

Yoplumpy

Registered User.
Local time
Today, 16:06
Joined
May 25, 2010
Messages
19
Hi All

I have to export various files which are queries to a single excel workbook.

I am using the code below (which I haven't been able to test - which is why I am here!)

Public Function ExportTblToExcel()
strFullPath = "C:\Users\Paul\Documents\FFP\Data Exports\QuarterlyDataExports.xlsx"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7, "qryAttendancesUNION", "ExcelWorkbook(*.xlsx)", False, "", , acExportQualityPrint
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7, "qryEXP12WeekProgAttendance", "ExcelWorkbook(*.xlsx)", False, "", , acExportQualityPrint
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7, "qryEXPFFPDataCore", "ExcelWorkbook(*.xlsx)", False, "", , acExportQualityPrint
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7, "qryEXPMentoringAttendance", "ExcelWorkbook(*.xlsx)", False, "", , acExportQualityPrint
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7, "qryEXPPathwayAttendance", "ExcelWorkbook(*.xlsx)", False, "", , acExportQualityPrint
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7, "qryEXPPrepPathwayAttendance", "ExcelWorkbook(*.xlsx)", False, "", , acExportQualityPrint

End Function

Aside from not knowing if I have the correct code - I can't seem to work out how to add a Button Control on a form to run (or attempt to run) the code..

Any help at all would be greatly appreciated!

Cheers

Paul
 
If you go to the HELP in Access (by clicking F1, not in the VBA editor but in the Access window) then type "Command Buttons" you should find a suitable tutorial.
 
I think you may also find you have a problem with trying to send the data to an acSpreadsheetTypeExcel7 to a file name of .xlsx.

I do believe you would want

acSpreadsheetTypeExcel14

for that file extension.
 

Users who are viewing this thread

Back
Top Bottom