VBA(EXCEL) import data from ms access

luffy88

New Member
Joined
Feb 13, 2017
Messages
8
Hello,
I have a problem with importing data from ms access to excel with VBA. I use "ADO Connection" to connect excel with acces. When I use "xlSheet.Range("A5").CopyFromRecordset rs" to import data from access db, it's works fine. But I want to skip some column in excel sheet. How can I do it? sorry im new in vba ..

my db table
idnamedatedescription

<tbody>
</tbody>



my excel sheet
ABCDE
id herename heredate hereskip columndescription here
..........

<tbody>
</tbody>
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Welcome to the forum!

Within your connection string, you can choose to select all (SELECT * ) and use code to insert a column (which would shift the description data to column E. You could also break things up and select id, name, date in your first copy from recordset command and repeat with selecting only the description and sending to E5.

Here's an article that explains ADO Connections in great detail:
Microsoft Access: Use ADO to Execute SQL statements
 
Upvote 0

Forum statistics

Threads
1,215,461
Messages
6,124,954
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top