Link to home
Start Free TrialLog in
Avatar of vbnetcoder
vbnetcoder

asked on

import spec: errror when importing date

My date is in this format "YYYYMMDD" and when i import it i get the error: "Type Conversion Failure"
SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vbnetcoder
vbnetcoder

ASKER

But this is a valid date format right? I don't think i should have to make it into a char field
>>But this is a valid date format right?
"YYYYMMDD" is not a valid date value (that's why you hitting conversion error, I assume your target table's field is a date field?), but "YYYY-MM-DD", "DD/MM/YYYY" or "DD MMM YYYY", etc is.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
for my purposed i decided it would work fine to make date fields text
I see that you have marked the question answered but you never got an accurate answer.  Yes, you can get Access to import this field as a date.  You just need to know how.

When you are using the import wizard, you can define this date format and Access will import it as a proper date field.  At any point in the wizard, click on the advanced button.  You will see options to choose a data field order.  Choose YMD.  You also have options that specify delimiters or no delimiters and leading zeros or not.  Choose no delimiters and leading zeros.  Then specify that column as a date.  Save the import spec and name it before clicking the finish button.  That way you can use the import spec in the TransferText method to automate the import.
<When you are using the import wizard, you can define this date format and Access will import it as a proper date field.>

NOT with data written  "YYYYMMDD"
Yes, you can.  I do it with files I get from a vendor.  The date actually comes to me as mmddyyyy but it doesn't matter since you can specify the field order.  

I included a sample .csv file in the import.  Use the import spec I created.
ImportFlatDate.zip