Copy data MSAccess to SQL Server w/VBA & ADO ( bulk Copy)

have an MSAccess database I need to recreate one of it's tables on SQL Server. I need to do it in VBA just after I create the MSAccess Table. What would the syntax be to copy and entire recordset to SQL Server. I know how to do it in a record cursor mode how do you do a bulk copy or can you.
 
My current code looks something like this:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Dim mxdb As Database
  Dim MainSet As Recordset


    Set MainSet = mxdb.OpenRecordset( _
    "SELECT D.field1, D.field2, C.field3, C.Field4 " & _
    "FROM (Cubes AS G LEFT JOIN Desc AS C ON G.CLASS = C.Class) " & _
    "     LEFT JOIN Comm AS D ON G.CODE = D.Alpha " & _
    "WHERE G.NAME='UXXX' " & _
    "AND G.CODE = '6' ")
   
   Set XY_Conn = New ADODB.Connection
   XY_Conn.Provider = "MSDASQL"
   XY_Conn.ConnectionString = "UID=XYadmin;PWD=XY001"
   DSNXX = "DRIVER={SQL Server};SERVER=PSQL04;UID=XYadmin;PWD=XY001;DATABASE=XY"
   XY_Conn.Open DSNXX
   
   Set XY_RecSet = New ADODB.Recordset
   strSQL = "Truncate Table XY_PSA"
   Set XY_RecSet = New ADODB.Recordset
   XY_RecSet.Open strSQL, XY_Conn

   Set XY_RecSet = New ADODB.Recordset
   XY_RecSet.Open "XY_PSA", XY_Conn, adOpenDynamic, adLockOptimistic
   
   With MainSet
      Do Until MainSet.EOF
     
       XY_RecSet.AddNew
         XY_RecSet!field1 = MainSet!field1
         XY_RecSet!field2 = MainSet!field2
         XY_RecSet!field3 = MainSet!field3
         XY_RecSet!field4 = MainSet!field4
       XY_RecSet.Update
 
      MainSet.MoveNext
     Loop
   End With
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

What would I do to reproduce this without walking through each record .
mbmalmAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

raopsnCommented:
Create a Link to the SQL Server table, and then you can write a Append query that selects data from your access table and inserts into SQL linked table

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
mbmalmAuthor Commented:
Excellent suggestion. Seems like such a logical solution, but I didn't think of it.
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.