Solved

Importing CSV Without Losing Decimals

Posted on 2014-10-07
3
542 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

730 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