PC Review


Reply
Thread Tools Rate Thread

csv Import into Access db

 
 
clk
Guest
Posts: n/a
 
      1st Dec 2010
I have a database set up that allows the user to click a button to
import a csv file for processing in the database. The process uses
"docmd.transferspreadsheet" code. This works just fine. The problem
is the company that sends them the csv file keeps changing it. Also,
they now have too many columns to be imported so they end up having to
delete columns out of the original csv file and then importing it. If
all the way a column has changed and they were not notified, it will
not import.

My question:

1. Is there anyway to import only certain columns of a csv file?
That way it shouldn't matter if they add a column or if there are too
many to import.

Any ideas are appreciated.

Thanks.
 
Reply With Quote
 
 
 
 
Stuart McCall
Guest
Posts: n/a
 
      1st Dec 2010
"clk" <(E-Mail Removed)> wrote in message
news:9b943219-dfec-4f22-8eee-(E-Mail Removed)...
>I have a database set up that allows the user to click a button to
> import a csv file for processing in the database. The process uses
> "docmd.transferspreadsheet" code. This works just fine. The problem
> is the company that sends them the csv file keeps changing it. Also,
> they now have too many columns to be imported so they end up having to
> delete columns out of the original csv file and then importing it. If
> all the way a column has changed and they were not notified, it will
> not import.
>
> My question:
>
> 1. Is there anyway to import only certain columns of a csv file?
> That way it shouldn't matter if they add a column or if there are too
> many to import.
>
> Any ideas are appreciated.
>
> Thanks.


Well one way would be to import all the fields into a temp table, then use a
query to select only the fields you want so you can transfer them to your
main table.


 
Reply With Quote
 
Ken Snell
Guest
Posts: n/a
 
      3rd Dec 2010
Using DoCmd.TransferText, you can speicify an import specification to
control the importation of a ".csv" file. The specification allows you to
designate columns as ones to be "skipped".

You create an import specification by manually beginning the import process
(via File | Export). When you're in the wizard window, click the Advanced
button at bottom left. In the new window, you'll see all the settings you
can specify. Enter all the information. Click Save As button and save them
as a specification (name it whatever you want, e.g., "MyEImportSpec", for
example). Click OK button to return to the main window of the wizard. Then
click Cancel button to cancel the rest of the import.

Now go to your TransferText code and add the name of the specification to
the appopriate argument position.

--

Ken Snell
http://www.accessmvp.com/KDSnell/




"clk" <(E-Mail Removed)> wrote in message
news:9b943219-dfec-4f22-8eee-(E-Mail Removed)...
>I have a database set up that allows the user to click a button to
> import a csv file for processing in the database. The process uses
> "docmd.transferspreadsheet" code. This works just fine. The problem
> is the company that sends them the csv file keeps changing it. Also,
> they now have too many columns to be imported so they end up having to
> delete columns out of the original csv file and then importing it. If
> all the way a column has changed and they were not notified, it will
> not import.
>
> My question:
>
> 1. Is there anyway to import only certain columns of a csv file?
> That way it shouldn't matter if they add a column or if there are too
> many to import.
>
> Any ideas are appreciated.
>
> Thanks.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
access import wizard doesn't import all rows of excel file Linda in Iowa Microsoft Access External Data 1 24th Aug 2008 04:48 AM
Import Wizard dropping fields defined by Import Spec Access 2007 DinosRose Microsoft Access External Data 4 11th Dec 2007 05:06 PM
how do I create an import spec in Outlook to import Access calend. =?Utf-8?B?Q29yeQ==?= Microsoft Outlook VBA Programming 1 8th May 2007 04:25 PM
Import user-defined fields from Outlook to Access Dynamic import ? =?Utf-8?B?Q2h1Y2tmMjAx?= Microsoft Access External Data 3 21st Nov 2004 07:30 AM
Re: I can import Access Tables. But, I can't import Access queries nickg420 Microsoft Excel Programming 0 5th Aug 2004 07:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:12 AM.