I am trying to export Records from a Access 2016 Database by a Date Range Query. The Code opens the database Window with the correct records from the query date range but when it transfers to the Excel file the entire database is exported.
Here is the VD Code used:
Private Sub Export_to_Excel_Click()
On Error GoTo ExportExcel_Err
DoCmd.OpenQuery "allinfoExcel", acViewNormal, acEdit
DoCmd.OutputTo acTable, "AMC products", "MicrosoftExcelBiff8(*.xls)", "I:\AMC Contact Mgmt Records.xls", False, "", 0
MsgBox "Check your I: Drive for the Excel File AMC Contact Mgmt Records!", vbOKOnly, ""