View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default How do i write data from Excel to a table in Access (2007)?

On Sat, 21 Feb 2009 04:08:01 -0800, Nigel Legg
<nigel.legg.at.katugas-research-services.co.uk wrote:

I have an Access 2007 database, which I want to write different sets of data
into. The datawill come from a web app in tab delimited or XML files, and
will require some reformatting in Excel prior to adding to Access, for
example the column headers in the tab delimited file become records in a
table. I therefore need to open my access database and the correct table
within it, and append the data, using VBA. How is this done? I can find
plenty of reference to taking data in the opposite direction, but nothing on
writing to Access.


Nigel: For this, I use ADO. Specifically I use the Execute method of the
Connection object

sqlInsert = "INSERT INTO tblTable.... etc."

adoConn.Execute sqlInsert

Here's some other resources:
http://www.dailydoseofexcel.com/arch...do-parameters/
http://www.dailydoseofexcel.com/arch...tables-in-vba/
http://www.dailydoseofexcel.com/arch...ordset-basics/
http://www.dailydoseofexcel.com/arch...essons-in-sql/

Note that while the Execute method is the easiest way, everyone tells me I
should be using the Command object and Parameters objects. If you're
already familiar with ADO, you may want to look into those objects.
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com