Solved

transfer delimited by "^".csv into access table using vba

Posted on 2014-02-06
4
1,268 Views
Last Modified: 2014-02-14
I have a large  .csv file which is delimited by "^" symbol. I need to transfer it to access database using VBA

I found the method below, but want a pure vba solution. is it even possible?

DoCmd.TransferText acImportDelim...
You need to create an Import Specification to do this automatically
To create the Import Specification
1) Click on external data> text file which then opens another window called "Get external data - Text file"
2) Use radio button to select "Import the source data into a new table in the current database"
3) specify the source of the file using the browse procedure then click OK
4) Choose radio button to select delimited format and then click next
5) this window allows you to choose delimiter and text qualifier and if first row contains names - click next
6) This window allows you to type the name of the field in the Field Name column, choose data type, and if you want field indexed - also can choose to skip field - then click next
7) This window allows you to add primary key or designate field as such - click next
8) Click on ADVANCED button
9. in the import specification window
type the name of the field in the Field Name column
(here you can use the field names of the destination table, specify data type,
check the box Skip if you do not want to import the column)
10 click save as, give the specification a name <-- this is the specification name that you will use in the command line below

DoCmd.TransferText acImportDelim, "ImportSpecificationName", "TableName", Returnvalue, blnHasFieldNames
 
0
Comment
Question by:maximyshka
  • 2
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39839406
<but want a pure vba solution. is it even possible? >

yes, as stated above, after creating the Import Specification,

you can use the command

DoCmd.TransferText acImportDelim, "ImportSpecificationName", "TableName", "c:\folder1\myCsv.csv", true
0
 

Author Comment

by:maximyshka
ID: 39839412
is there any way to do it without using Import specifications?
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39839510
<is there any way to do it without using Import specifications? > Sorry but NO.
0
 
LVL 33

Expert Comment

by:ste5an
ID: 39841343
is there any way to do it without using Import specifications?

Sure, use LINE INPUT and parse it manually. But I'm quite sure, this is a road you don't want to take.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question