I am a real rookie trying to apply a filter before I run an sql statement. I have some code that constructs the filter, and I think I just learned how to use an alias to represent the filtered data. Here is the SQL for that:
SELECT WetVeg.* FROM WetForm INNER JOIN WetVeg ON WetForm.ID1 = WetVeg.ID2 WHERE WetForm.ProjectSite = "a" as x;
So my hope was that the alias x would be used in the code below so the data would be pulled from the filtered result.
I get a syntax error, so what I have left out, commas, quotes, parens?
Dim sqltext As String
sqltext = "SELECT z.Spename INTO ProjectSpeciesListOutput "
sqltext = sqltext & "FROM(SELECT SP1 AS Spename FROM x UNION "
sqltext = sqltext & "SELECT SP2 AS Spename FROM x UNION "
sqltext = sqltext & "SELECT SP3 AS Spename FROM x) as z Group by z.spename"