I have created button and put this code to export in excel file. It works perfectly fine. It give me two tab Query1 and Query2 and file name Output_Result_15-Jan-2018.xlsx
Dim xl As Object
DoCmd.TransferSpreadsheet acExport, , "Query1", "C:\Input\Output_Result_" & Format(Date, "MMM-DD-YYYY") & ".xlsx", True
DoCmd.TransferSpreadsheet acExport, , "Query2", "C:\Input\Output_Result_" & Format(Date, "MMM-DD-YYYY") & ".xlsx", True
Set xl = CreateObject("Excel.application")
xl.workbooks.Open ("C:\Input\Output_Result_" & Format(Date, "MMM-DD-YYYY") & ".xlsx")
xl.Visible = True
Set xl = Nothing
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
But I want same result in csv file. I changed to some code for csv but it gives me only result of Query2 and not Query1. Where I am making mistake , kindly help me out.
Dim xl As Object
DoCmd.TransferText acExportDelim, , "Query1", "C:\Input\Output_Result_" & Format(Date, "MMM-DD-YYYY") & ".csv", True
DoCmd.TransferText acExportDelim, , "Query2", "C:\Input\Output_Result_" & Format(Date, "MMM-DD-YYYY") & ".csv", True
Set xl = CreateObject("Excel.application")
xl.workbooks.Open ("C:\Input\Output_Result_" & Format(Date, "MMM-DD-YYYY") & ".csv")
xl.Visible = True
Set xl = Nothing