Solved

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

Posted on 2014-02-06
4
1,264 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Attachment field in SQL 3 28
Access Update Query 1 20
Simple SQL query from two tables 13 54
SYbase 4 30
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

770 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