SQL Code to Combine Two Tables
Posted on 2011-03-08
I'm trying to combine two MS Access tables into a single table within a DoCmd. here is what I have:
DoCmd.RunSQL "SELECT " & AxysCodestr & ".*, " & Modelstr & ".* INTO xyz FROM " & AxysCodestr & " FULL JOIN " & Modelstr & " ON (" & AxysCodestr & ".Symbol = " & Modelstr & ".Symbol) WHERE " & AxysCodestr & ".Symbol IS NULL OR " & Modelstr & ".Symbol IS NULL"
I know it looks ugly - it's because the 'strings' AxysCodestr and 'Modelstr' may change. In my example they are not changing, but I wanted to be as close to what I'm trying to accomplish as possible.
Eveytime my code executes the above line - I get a 'Syntax Error in FROM clause'.
Does anyone see anything blatanly wrong?