Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Importing CSV Without Losing Decimals

Posted on 2014-10-07
3
Medium Priority
?
681 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 2000 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 custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

971 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