Solved

Importing CSV Without Losing Decimals

Posted on 2014-10-07
3
464 Views
Last Modified: 2014-10-07
I am importing some large CSV files to Access. I've tried linking to the tables and using append queries, straight imports, and just about every field definition I can think of, but there are some columns that have decimals in them and I lose them on the finished product.

The majority of the values in these columns are "1" - so when Access examines the file for import, it interprets it as a long integer. I've changed the destination table field to Double to catch the decimal values, but it still suppresses everything after the decimal. I even tried text as a field type.

Since the file I am importing is a .csv, I don't get very extensive options when importing. But I have to get this data into my database WITH the decimal values.

Any help appreciated.
0
Comment
Question by:Buck_Beasom
3 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40365985
Edit the data - Create a dummy first row, which has a decimal value (e.g. 1.23), and then delete that dummy row.
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 40366059
you need to create import specification first.

 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", "C:\folderName\myText.csv" , True



.
0
 

Author Closing Comment

by:Buck_Beasom
ID: 40366675
Perfect. Thanks!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

16 Experts available now in Live!

Get 1:1 Help Now