xls technique question

mdmilner

Well-known Member
Joined
Apr 30, 2003
Messages
1,362
I may be 'missing' something so I wanted to ask.
In the last year, I've gravitated away from using spreadsheets (xls) as a preferred way to import data into an Access database. The main reason is the amount of control over imported field types that I gain from using specification templates and importing raw text files.

I'm interested in any suggestions as abstract or detailed as you'd like to make it.

Mike
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi Mike

I too default to Access where there is a lot of data to be manipulated for a few reasons : mainly speed, error control, exception filtering etc. Is there anything in particular you think you might be "missing"? BTW I entered "importing data into Microsoft Access" into Google and it returned about 800k pages!

Andrew :)
 
Upvote 0
What I mean is, given the ability to choose the form of my imported information...my first choice is for it to be raw text.

Using methods like DoCmd.TransferSpreadsheet, although slick, do not always guess well as to field data types.

Mike
 
Upvote 0
mdmilner,
I usually import the excel data into a raw data Table. Then using a append query, I assign the values to a table already created with the correct data types. If something doesn't match, you will get an immediate error. I don't see CSV or text as being an improvement over that. I would most likely need to do something similiar, to the CSV/txt file, if I needed to control the assigned data types. Of course, at the end of the day it doesn't really matter. The only problem I could see, is if you have other users dealing with the CSV files. It takes a certian level of understand to work with CSV files, versus a standard office tool like excel.

Cal
 
Upvote 0
I usually import the excel data into a raw data Table
Cal

Do you mean a table that has just text fields?
 
Upvote 0
Norie,
I just let it default to the basic import values, and if I need to reassign the data types, I do via an append query. That way, if any of the data needs to be translated into other formats, you can build a custom query field's. Sometimes, the dates, aren't quite dates, and times aren't quite times, so this give's you more flexibility. Of course the same would apply to CSV and TXT files as well.
 
Upvote 0
Cal

So you mean that you let Access decide the data types?

I find that sometimes that can be a disaster. Recently I was importing data (about 100000 records) from 3 different files.

As far as I was aware the date field in each file was formatted the same - but it wasn't.

The import was done using code and I must of done it about 4-5 times till I realised what was wrong.

So I ended up importing in to a table with the date field as text type.

The imported table was appended to another table where the date field was of date type and all the dates converted fine.
 
Upvote 0
Norie,
That situation seems really familiar. It's been a while since this last time I had to setup something like this, so perhaps I'm misremebering, cause it also sounds more logical. I think I may have bypassed that problem by not importing the titles(because some were invalid), even though the sheet had titles. So the first line of the table would automatically be ID'ed as a text field. Then I would filter the titles out in the query, as well as reformatting the date, and such.

Cal
 
Upvote 0
That's exactly my experience. Frequently importing using the Access Guess Wizard is catastrophic and simply won't work. What I prefer is to import a raw text file using a specification and forcing potential trouble fields in as text. I then append it to a correctly formatted table that actually gets used.

I've actually gone so far as to 'package' this. Set up a few tables/forms/code to 'script' a series of actions. My current package will FTP/Import/Build(append)/Update(fix fields like dates) - I've also got one piece setup so I can build joined queries from my 'scripting' package.

Pretty much, I do imports once manually, then set it up to do it via code from that point on. Here's what my scripting table looks like - walk thru it sequentially to see what order things run.
Book1
ABCDEFGH
1Desc_tasktask_nametask_seqtask_typesrcFiledstFileoptInfodisable
2CSXIPaidClaimsFTP_clmpd12OPENTBLtblImodFALSE
3CSXIPaidClaimsFTP_clmpd13FINDFILES:\Intermodal\IntermodalClaims\FALSE
4CSXIPaidClaimsFTP_clmpd1FTPFLRSFCP.FOC.ACROSSF.DATAAcrossFALSE
5CSXIPaidClaimsFTP_clmpd2FTPFLRSFCP.FOC.FCD1F.DATAfcd1FALSE
6CSXIPaidClaimsFTP_clmpd3FTPFLRSFCP.FOC.OFFCOREF.DATAoffcoreFALSE
7CSXIPaidClaimsFTP_clmpd4IMPORTAcrossAcrossacrossimportFALSE
8CSXIPaidClaimsFTP_clmpd5IMPORTfcd1fcd1fcd1importFALSE
9CSXIPaidClaimsFTP_clmpd6IMPORToffcoreoffcoreoffcoreimportFALSE
10CSXIPaidClaimsFTP_clmpd7BUILDacrosstblImodFALSE
11CSXIPaidClaimsFTP_clmpd8BUILDfcd1tblImodFALSE
12CSXIPaidClaimsFTP_clmpd9BUILDoffcoretblImodFALSE
13CSXIPaidClaimsFTP_clmpd10UPDATEtblImod14FALSE
14CSXIPaidClaimsFTP_clmpd11UPDATEtblImod15FALSE
Sheet1


Mike
 
Upvote 0

Forum statistics

Threads
1,221,829
Messages
6,162,229
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top