Solved

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

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

Assisted Solution

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

Accepted Solution

by:
Rey Obrero 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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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 119

Assisted Solution

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Modern/Metro styled message box and input box that directly can replace MsgBox() and InputBox()in Microsoft Access 2013 and later. Also included is a preconfigured error box to be used in error handling.
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…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

920 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

16 Experts available now in Live!

Get 1:1 Help Now