Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Are There Any CSV File Field Column Mapper Tools For MS Access CSV File importing

Posted on 2016-11-13
12
Medium Priority
?
91 Views
Last Modified: 2016-11-13
I was wanting to import CSV Files into Access but they have different names and are arranged in different orders. Are there any tools for this or can this be done in Access by VBA or something else? I will need to append these CSV New Records to my existing Access Tables.
Thanks!
0
Comment
Question by:Dustin Stanley
[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
  • 5
  • 4
  • 3
12 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 41885403
the easier way is to import the CSV file (using import specification) to a temp table, then use an append query to add the records to the existing table.
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 1000 total points
ID: 41885407
the other way is to create a table to map (mapping table) the CSV column names to the existing table field names.
use a User define function to import the csv file and determine which csv column name corresponds to the table field using the mapping table.
0
 

Author Comment

by:Dustin Stanley
ID: 41885410
Would I delete the table afterwards or could I use that same table over and over? I suppose I could set up long term temp table with the same field names as from the CSV file that I am importing from. I will be using this table daily but I want the information to be truly stored in My Database Table not a Temp Table.

How would I completely clear out this Tempt Table besides fieldnames after I run the Append Query to append to My Table from the Temp Table?

mapping table

This would store the information in the Tempt Table and not My table Correct? If so I don't think that will work long term for me.
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 22

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 1000 total points
ID: 41885415
adding on to what Rey said

to make sure all the data comes in, you may want to set the data type for each column to be text. Access will convert to numbers and dates when you append them

just saw your new post.  You can use the same table (that way you won't have to set the fields to text, the table definition can do that).  Be sure to compact/repair database when you open again, just after you back it up, in case something happens during that process. Creating records and deleting them will bloat the database.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1000 total points
ID: 41885418
another way is to Link to the CSV file.
this can also be done using vba codes after selecting the CSV file

docmd.TransferText acLinkFixed, "specificationName","TableName","C:\myFolder\myCSV.csv",true

or
docmd.TransferText acLinkDelim, "specificationName","TableName","C:\myFolder\myCSV.csv",true


--- to clear the temp table, just create delete query

delete * from tempTable
0
 

Author Comment

by:Dustin Stanley
ID: 41885420
to make sure all the data comes in, you may want to set the data type for each column to be text.

So your saying make the tempt table fields all text. Then when I Append them to My Table access will automatically convert them to the correct data type..Correct?
0
 

Author Comment

by:Dustin Stanley
ID: 41885429
another way is to Link to the CSV file.

Ok so I can directly link with this file...These CSV files will be exported from a location daily and placed on to my PC. The daily CSV file will have only new updated info. Nothing from the day before (Yesterday).

Would I Delete Yesterday's file (or rename it) and then make sure the new day (Today's) file has the same name as Yesterdays File?
0
 

Author Comment

by:Dustin Stanley
ID: 41885432
By the way there should NOT be any relationships to this Temp Table Correct?
0
 
LVL 22

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 1000 total points
ID: 41885435
> "make the tempt table fields all text"

yes. That is what I do. sometimes the expected data type is not actually what is in a field and when that happens, the whole record won't come in.  By setting to text, you can ensure everything comes in. Then, after appending to where it needs to go, you should :

1. filter records for the new ones
2. sort by the number and date columns, one at a time, and make sure there aren't blanks.  If there are, you can look at the temporary import table.

When importing, it is good to start the tablename with "import" so it is easy to find -- and later delete if you want.

> "NOT be any relationships to this Temp Table Correct?"
yes

Rey also mentioned: "another way is to Link to the CSV file" -- if you are doing this everyday, this might be good to consider doing instead of actually importing.
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 1000 total points
ID: 41885508
-first time when you create a link to the CSV file, you can specify the name for the Linked CSV.
-second time you make a link to the CSV file and use the same name, it will overwrite the first link you created.

you do the linking by
external data > text file > browse and locate the csv file > select link to the data source ...  click OK and follow the wizard
0
 

Author Closing Comment

by:Dustin Stanley
ID: 41885657
Thank You!
0
 
LVL 22
ID: 41885699
you're welcome ~ happy to help
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

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…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

715 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