I need help modifying the following query:
**************
INSERT INTO UPSWorldshipInfo ( OrderNum, Company, Street, City, State, CountryCode, Zip, Phone, Null1, Null2, EmailAdr, OrderValue, ShipmentCode, ShipmentMethod )
SELECT Shipinfo.OrderNum, Shipinfo.Company, Shipinfo.Street, Shipinfo.City, Shipinfo.State, Shipinfo.CountryCode, Shipinfo.Zip, Shipinfo.Phone, Shipinfo.Null1, Shipinfo.Null2, Shipinfo.EmailAdr, Shipinfo.OrderValue, Q.[Shipment Code], Q.Method
FROM [Select S.[Order ID], S.[Shipment Code],
Mid(S.[Shipment Method],InStr(S.[Shipment Method],'USPS'),4) AS Method
from Shipments S where InStr(S.[Shipment Method],'USPS') >0
UNION ALL
Select S.[Order ID], S.[Shipment Code],
Mid(S.[Shipment Method],InStr(S.[Shipment Method],'UPS'),3) AS Method
from Shipments S where InStr(S.[Shipment Method],'UPS') >0
]. AS Q, Shipinfo
WHERE (((Shipinfo.OrderNum)=Q.[Order ID]));
************************
This query takes two data from two tables shipinfo.txt and shipments.csv and puts it into UPSWorldshipInfo table. This query works fine right now but now my shipments.csv has two extra columns and does not work when those two extra columns are there.
ORDER_ID SHIPMENT_CODE WEIGHT ADDRESS CITY STATE ZIP SHIPPING_METHOD
ORDER_ID SHIPMENT_CODE WEIGHT NAME ADDRESS CITY STATE ZIP SHIPPING_METHOD PROD_COUNT
So the NAME and PROD_COUNT are new and the query does not work with these two new fields. I don't know how to program this and and can't get a hold of the guy who did it. I tried making one little change and then tried saving the macro and I get the following error:
Invalid bracketing of name 'Select S.[Oder_Id'
So not able to save the existing working query and need to know how to fix that and what to change to make query work with new columns
Thanks for any help.
Scott