I have one table with data. By using select statement specific data I want to select and Export in Excel. when I am clicking on Export button the excel file generated without data.
I have one table with data. By using select statement specific data I want to select and Export in Excel. when I am clicking on Export button the excel file generated without data.
Can you explain this in more detail?By using select statement specific data I want to select and Export in Excel. when I am clicking on Export button the excel file generated without data.
If this some specific to your database?
Maybe a Form with a command button and some VBA attached to it?
If so, we will probably need to see the VBA code.
Mayur,
Try this way.
Create Query > Create Report . Go to design view add button call it export to excel.
Now go to on click event, create a macro with exportWithFormat , choose output as excel.
U should be good to go bro.
![]()
Yes I required VBA code for export the file.
Use below if your query does not have memo fields (more than 255 characters string in single column).
DoCmd.OutputTo acOutputQuery, "QueryName", _
acFormatXLS, "ReportName.xls", True
If your query contains memo fields having more than 255 characters, first output query to a table. And than output table using TransferSpreadsheet method
Currentdb.Execute "SELECT INTO TableName FROM QueryName"
docmd.TransferSpreadsheet acExport,acSpreadsheetTypeExcel9, "TableName", "C:\OutputFilePath\OutfileName.xls", True