Solved

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

Posted on 2016-11-13
12
27 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 119

Expert Comment

by:Rey Obrero
Comment Utility
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 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 total points
Comment Utility
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
Comment Utility
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
 
LVL 18

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 250 total points
Comment Utility
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 119

Accepted Solution

by:
Rey Obrero earned 250 total points
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:Dustin Stanley
Comment Utility
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
Comment Utility
By the way there should NOT be any relationships to this Temp Table Correct?
0
 
LVL 18

Assisted Solution

by:crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access earned 250 total points
Comment Utility
> "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 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 total points
Comment Utility
-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
Comment Utility
Thank You!
0
 
LVL 18
Comment Utility
you're welcome ~ happy to help
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now