Union two table into one through VBA

Have the following code I am working with.

It should take the two tables "NEXT_FT" and "THIS_FY", union them together and push that data into a table called schedule.

Any help would be great.

Private Sub Command2_Click()
'UNIONS NEXT AND THIS FY CLASS DATA INTO SCHEDULE'
Dim mySLC As String
mySLC = "SELECT * INTO SCHEDULE" & _
        " FROM THIS_FY" & _
        " UNION" & _
        " SELECT *" & _
        " FROM NEXT_FY"
Debug.Print mySLC
DoCmd.RunSQL mySLC
End Sub
IZIKILL2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongSoftware Team LeadCommented:
try:

mySLC = "SELECT " & _
        " (Select * FROM THIS_FY" & _
        " UNION" & _
        " SELECT *" & _
        " FROM NEXT_FY) " & _
        "INTO SCHEDULE "
flavoCommented:
SELECT q.* INTO myNewTableName
FROM (
          SELECT *
          FROM THIS_FY
          UNION
          SELECT *
          FROM FROM NEXT_FY
          ) AS q

Dave

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jerryb30Commented:
If the two tables are always the same, and the fields are the same in the same order,  there is not real advantage to building this union query in vba.  At any rate, you would have to save the string as a query definition in order to invoke a make-table query to push the data into 'schedule.'
Select * from this_fy
union all
select * from next_fy;
if saved as yourquery
sellct * into schedule from yourquery.

Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Ryan ChongSoftware Team LeadCommented:
sorry, should be as:

Select * INTO SCHEDULE From (
Select * FROM THIS_FY
         UNION
         SELECT *
         FROM NEXT_FY
)

no points for this as already posted by flavo. cheers
jerryb30Commented:
clever, dave.
IZIKILL2Author Commented:
Thats it Dave, thank you.
flavoCommented:
Thanks Izi and Jerry :P

Dave
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.