Solved

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

Posted on 2016-11-13
12
55 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
  • 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 250 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 19

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 250 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 250 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 19

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 250 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 250 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 19
ID: 41885699
you're welcome ~ happy to help
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
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…
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
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…

839 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