Solved

Importing CSV Without Losing Decimals

Posted on 2014-10-07
3
524 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 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

827 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