Automating Importing a CSV file in Access from VB 
Author Message
 Automating Importing a CSV file in Access from VB

I wonder if anyone can help with the following, which is probably
blindingly obvious, but has so far eluded me.

I am using an access DB and want to simply import a CSV file into it.

I can do it very easily by USING the FILE,GET EXTERNAL DATA,IMPORT
menu option in Access, I then follow the basic options and the file is
then imported into my DB Table (which has the same number of fields as
the CSV file and causes no problems at all)

The problem I am having is that I am using a VB program to manipulate
the Data Base and I would like to make the VB program to automatically
do the above import routine each time it is run.

I have tried with the DoCmd.Transferspreadsheet objects in VB from the
Access object library however it requires a parameter to identify the
sheet being imported and I cant find one the corresponds to CSV files.

I am wondering if there is a way of creatig a save query,however I
cant get this to work either.

Thanks in advance  for any ideas
Best Regards
Mark Williams



Sun, 27 Jun 2004 00:36:35 GMT
 Automating Importing a CSV file in Access from VB

You can use this:
DoCmd.TransferText acImportDelim, , "Import_Table_Name", "C:\Test.csv", True
Quote:

> I wonder if anyone can help with the following, which is probably
> blindingly obvious, but has so far eluded me.

> I am using an access DB and want to simply import a CSV file into it.

> I can do it very easily by USING the FILE,GET EXTERNAL DATA,IMPORT
> menu option in Access, I then follow the basic options and the file is
> then imported into my DB Table (which has the same number of fields as
> the CSV file and causes no problems at all)

> The problem I am having is that I am using a VB program to manipulate
> the Data Base and I would like to make the VB program to automatically
> do the above import routine each time it is run.

> I have tried with the DoCmd.Transferspreadsheet objects in VB from the
> Access object library however it requires a parameter to identify the
> sheet being imported and I cant find one the corresponds to CSV files.

> I am wondering if there is a way of creatig a save query,however I
> cant get this to work either.

> Thanks in advance  for any ideas
> Best Regards
> Mark Williams



Sun, 27 Jun 2004 09:29:46 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Automating import of CSV files

2. Automating .csv file import into SQL 7

3. Automating .csv file import into SQL 7

4. Automate Import/Export to text or CSV file

5. CSV Import into Access via VB

6. Import CSV Doc in VB to Access Table

7. Importing CSV file to Existing Access DB

8. Import CSV file into Access table using ADO

9. Import and Export from .CSV files in Access with VB6 Code

10. Problem importing CSV file into an Access Database

11. Dts Import Question:Importing Csv file in an existing SQL2000 table with row-level conditions


 
Powered by phpBB® Forum Software