Import Excel Files in Access using VB

Payal Patel

Registered User.
Local time
Today, 05:55
Joined
Nov 3, 2009
Messages
34
Hi,
I'm trying to import an excel file to access using the command button with the following code:
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="Test", filename:="C:/PKP/Test2.xls", HasFieldNames:=True

My excel file has many blank columns in the middle which i do not want to import. Does anyone know how I can show specific columns i want to bring into my access table?
thanks,
 
The simplest of methods is to import to a temp table which has all columns including the blank ones and then use an append query to move the data you want to the actual table and then use a delete query to clear the temp table (not suggesting to use make table and delete the table, but to have a table which is created ONCE when you first set things up and then you just import to it and delete the data when through).
 
thank you --- that will work
 

Users who are viewing this thread

Back
Top Bottom