Solved

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

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

Expert Comment

by:Rey Obrero
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 119

Accepted Solution

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

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now