UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Importing Spreadsheet Errors    
 
   
bbarbarito
post Feb 14 2012, 06:31 PM
Post #1

New Member
Posts: 9



I am importing an excel spreadsheet (using DoCmd.TransferSpreadsheet acImport) into an access data base table. I am getting a type conversion import error on a field.

The field is defined as a text field. If the first record of the file has alpha characters in the field, I don't get any errors; however, if the first record of the file has only numeric characters in the field, I get the error on records that contain alpha characters in that field

Any help would be greatly appreciated
Thank you
Go to the top of the page
 
+
Jeff B.
post Feb 14 2012, 07:35 PM
Post #2

UtterAccess VIP
Posts: 8,170
From: Pacific NorthWet



If you ask Access to import a spreadsheet, it looks at the data type in the first ("n") columns and decides what the data type is for the field.

If you don't want Access to decide, create a table that has the data types you KNOW are correct, then import the data from the spreadsheet into THAT table.

(that should have been "...in the first ("n") rows...")
Go to the top of the page
 
+
bbarbarito
post Feb 15 2012, 12:45 PM
Post #3

New Member
Posts: 9



HI Jeff, Thank you for your time

The excel spreadsheet is being imported into a table (using append) that is already defined and in some circumstance already has data in it. I have attached a snippet of the table's design view

Thank you
Go to the top of the page
 
+
Jeff B.
post Feb 15 2012, 04:31 PM
Post #4

UtterAccess VIP
Posts: 8,170
From: Pacific NorthWet



Here's another approach ...

If the data MUST be text, even if digits, then:
1) set up your table so that field is text (sounds like you've already done this)
2) link to or import your "raw" data
3) build a query that coerces that problem field into text (see CStr() function in Access HELP)
4) use that query to append to your permanent, well-normalized table (see #1)
Go to the top of the page
 
+
ScottGem
post Feb 15 2012, 04:35 PM
Post #5

UtterAccess VIP / UA Clown
Posts: 25,091
From: LI, NY



QUOTE (bbarbarito @ Feb 15 2012, 12:45 PM) *
HI Jeff, Thank you for your time

The excel spreadsheet is being imported into a table (using append) that is already defined and in some circumstance already has data in it. I have attached a snippet of the table's design view

Thank you


Don't import the sheet, Link to it and then run an APPEND query that converts the data.
Go to the top of the page
 
+
strive4peace
post Feb 17 2012, 12:51 AM
Post #6

UtterAccess VIP
Posts: 20,211
From: Colorado



hi bbarbarito (what is your name?)

I often make a dummy row of data in Excel after the column headers. For each text cell, write "dummy". for each date cell, push ctrl ; and for each number, enter 0

then delete it or filter it out
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 26th May 2013 - 04:22 AM