I want to run an append query in VBA code. When trying to run the sql statements I made I always got "Syntax error in join operation" errors, therefore I tried making a query and "sub"query through access. Which worked.
But I still have problems when I try to replace the "sub"query with the sql code from the other query (added () around it). I need the entire sql statement to run it with VBA code so I cannot just execute the stored query(going to use values from a form) so I would appreciate it if someone could help me.
Here are the two queries which work but should be added together to one sql statement. QueryA uses QueryB.
INSERT INTO tblTmpUseRelations ( Plant, RequestName )
SELECT DISTINCT QueryB.Plant_forsyn, QueryB.RequestName
FROM QueryB LEFT JOIN tblPlants ON QueryB.Plant_forsyn = tblPlants.Plant
WHERE (((tblPlants.Plant) Is Null));
SELECT tblPlantRelations.Plant_forsyn, tblPlants.RequestName, tblPlants.Plant
FROM tblPlantRelations INNER JOIN tblPlants ON tblPlantRelations.Plant_offshore = tblPlants.Plant
WHERE (((tblPlants.RequestName) Like 'A111111') AND ((tblPlantRelations.ImportType) Like 'Other'));