Hi,
I tried to use the same process of updating my table source using SQL. Which is i only copy the SQL from design view and manipulate it in VBA. This is my first time to use this process in a query that will create table. I just don't know why my code returns "query input must contain at least one table or query". When i run this SQL in query design view, it works fine but when i incorporate this in my VBA code it returns 3067 error.
Please see my code below.
I tried to use the same process of updating my table source using SQL. Which is i only copy the SQL from design view and manipulate it in VBA. This is my first time to use this process in a query that will create table. I just don't know why my code returns "query input must contain at least one table or query". When i run this SQL in query design view, it works fine but when i incorporate this in my VBA code it returns 3067 error.
Please see my code below.
Private Sub btnExcel_Click()
Dim SQL As Variant
SQL = "SELECT tbl_Tariff.Description, tbl_Tariff.TariffCode, tbl_Tariff.JobID INTO Tariff_Table" _
& "FROM tbl_Tariff" _
& "WHERE (((tbl_Tariff.JobID)=[Forms]![mainTariffSearch]![txtClearID]) AND ((tbl_Tariff.Choose)=True));"
DoCmd.RunSQL SQL
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "tariff_Table", "C:\Exports\Spreadsheet.xls"
End Sub