ACCESS 2010: VBA query error.
Posted on 2014-01-23
Once again, I have inherited a database from a user that no longer works at my company. There is a module that is designed to update several tables and it keeps erroring out at one point while trying to run a query. I have not gone this deep in VBA programming and I have not been able to figure it out. The error message has something to do with the inner joins. Here is a sample of the query, but I will attach the actual code from the module:
SELECT QTY.FMS_KEY, QTY.PACK_ID, QTY.FO_STATUS, QTY.FO_DATE,
DatePart('yyyy',[FO_DATE],2,2) AS Year, DatePart('ww',[FO_DATE],2,2) AS Fw,
Mid([ADN_NO],1,4) AS UNIT, REC.PARTNUMBER, REC.OPER_FROM,
FROM FMS_DB_FO_QUANTITY AS QTY
INNER JOIN (FMS_DB_FO_RECORD AS REC
INNER JOIN (FMS_DB_FO_SUPPLIER AS SUP
INNER JOIN FMS_DB_FO_PO_HEADER AS POH
ON SUP.SUPPLIER_ID = POH.SUPPLIER_ID)
ON (REC.PO_NUMBER = POH.PO_NUMBER) AND (REC.PO_YEAR = POH.PO_YEAR))
ON (QTY.FMS_KEY = REC.FMS_KEY) AND (QTY.PACK_ID = REC.PACK_ID)
WHERE QTY.FMS_KEY=' & rstFO_Barcodes![fms_key] & '
AND QTY.PACK_ID=' & rstFO_Barcodes![pack_id] & '
ORDER BY QTY.FO_DATE;