If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Exporting data to Access using VB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-12-09, 04:35
bibbyd01 bibbyd01 is offline
Registered User
 
Join Date: Jun 2009
Posts: 2
Exporting data to Access using VB

Hi

I'm trying to find a way of exporting data from an excel spreadsheet into an access database using VB code. I've already extracted data from Access into Excel, but that appears to have been the easy bit.

What I need is either pointing in the direction of some kind of guide, or help in writing a bit of code that allows me to open an access table, delete any records, then update it with the data from the excel spreadsheet (which is already formatted correctly).

Any help would be much appreciated!
Reply With Quote
  #2 (permalink)  
Old 06-12-09, 09:04
weejas weejas is offline
Registered User
 
Join Date: Sep 2006
Location: Surrey, UK
Posts: 448
Is this going to be run from Access or Excel?

Either way, you need to create and run a DELETE SQL statement against the destination table. Once that's done, you then execute a DoCmd.TransferSpreadsheet statement using the Excel file as the filename and the table as the table name.
Reply With Quote
  #3 (permalink)  
Old 06-12-09, 09:51
bibbyd01 bibbyd01 is offline
Registered User
 
Join Date: Jun 2009
Posts: 2
It's going to be run from Excel

Are there any examples of those? I'm having to use excel/access 2003, and I've found some bits on 2007 but they don't work in my version. I'm also a little new to intergrating these two together, but other people are making a batallion of mistakes, so I wanted to make it so they couldn't!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On