Type Conversion Failure!!!!

  • Follow


I am trying to import a .csv text file into access using an import 

specification and everytime I try to import the data I get a type 

conversion failure because there is no percentage data type that will 

recognize the values that are in the .csv file.

Does anyone know how I can accomplish this import?  I am really 

wanting to automate this import process somehow using VBA and need to 

first get this data in the table.


Any help would be greatly appreciated!!!

Thanks in advance,

Greg

0
Reply gregperry 3/13/2010 12:35:01 AM

The data field that I am trying to import that is causing the problems has
percent data in it.

gregperry wrote:
>I am trying to import a .csv text file into access using an import 
>
>specification and everytime I try to import the data I get a type 
>
>conversion failure because there is no percentage data type that will 
>
>recognize the values that are in the .csv file.
>
>Does anyone know how I can accomplish this import?  I am really 
>
>wanting to automate this import process somehow using VBA and need to 
>
>first get this data in the table.
>
>Any help would be greatly appreciated!!!
>
>Thanks in advance,
>
>Greg

0
Reply gregperry 3/13/2010 12:38:02 AM


I import .csv text files into my application.  There's nothing special I do 
about any of the data elements.  After reading each input record, I simply 
parse it into a Variant array.  I then deal with each element, one at a 
time.

It would seem that if a specific element (Variant by that time) is a 
percentage, you would deal with it accordingly.  The fact that it came from 
a .csv text file is no longer a material matter.

bob

"gregperry" <u58729@uwe> wrote in message news:a4ebfa1fabd68@uwe...
> The data field that I am trying to import that is causing the problems has
> percent data in it.
>
> gregperry wrote:
>>I am trying to import a .csv text file into access using an import
>>
>>specification and everytime I try to import the data I get a type
>>
>>conversion failure because there is no percentage data type that will
>>
>>recognize the values that are in the .csv file.
>>
>>Does anyone know how I can accomplish this import?  I am really
>>
>>wanting to automate this import process somehow using VBA and need to
>>
>>first get this data in the table.
>>
>>Any help would be greatly appreciated!!!
>>
>>Thanks in advance,
>>
>>Greg
> 


0
Reply Bob 3/14/2010 1:31:55 PM

i can help you
"gregperry" <u58729@uwe> wrote in message news:a4ebf397e3794@uwe...
>I am trying to import a .csv text file into access using an import 
> 
> specification and everytime I try to import the data I get a type 
> 
> conversion failure because there is no percentage data type that will 
> 
> recognize the values that are in the .csv file.
> 
> Does anyone know how I can accomplish this import?  I am really 
> 
> wanting to automate this import process somehow using VBA and need to 
> 
> first get this data in the table.
> 
> 
> Any help would be greatly appreciated!!!
> 
> Thanks in advance,
> 
> Greg
>
0
Reply skarlet 3/24/2010 12:36:14 AM


"gregperry" <u58729@uwe> ha scritto nel messaggio news:a4ebf397e3794@uwe...
> I am trying to import a .csv text file into access using an import 
> 
> specification and everytime I try to import the data I get a type 
> 
> conversion failure because there is no percentage data type that will 
> 
> recognize the values that are in the .csv file.
> 
> Does anyone know how I can accomplish this import?  I am really 
> 
> wanting to automate this import process somehow using VBA and need to 
> 
> first get this data in the table.
> 
> 
> Any help would be greatly appreciated!!!
> 
> Thanks in advance,
> 
> Greg
> 
0
Reply celeste 3/25/2010 9:16:30 AM

My question is how can I deal with it accordingly when there is no percentage
data type for an access import spec?  It automatically converst the
percentage to a string.

Bob Howard wrote:
>I import .csv text files into my application.  There's nothing special I do 
>about any of the data elements.  After reading each input record, I simply 
>parse it into a Variant array.  I then deal with each element, one at a 
>time.
>
>It would seem that if a specific element (Variant by that time) is a 
>percentage, you would deal with it accordingly.  The fact that it came from 
>a .csv text file is no longer a material matter.
>
>bob
>
>> The data field that I am trying to import that is causing the problems has
>> percent data in it.
>[quoted text clipped - 18 lines]
>>>
>>>Greg

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-conversion/201003/1

0
Reply gregperry 3/25/2010 10:14:06 PM

Thank you for your reply.  I am still at a loss with this particular issue.
I ended up just importing the value as a string and using the left & right
string functions to pull the percentage sign off and recalculate the string
as a percentage.  Which works fine I guess, I was just wondering if there
wasn't a more effective way to handle this.

skarlet wrote:
>i can help you
>>I am trying to import a .csv text file into access using an import 
>> 
>[quoted text clipped - 15 lines]
>> 
>> Greg

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-conversion/201003/1

0
Reply gregperry 3/25/2010 10:16:46 PM

In my opinion, you should first remove all '%' signes in your .csv file by 
opening the file and reading line by line using something like 
'replace(line1,'%','')' which will replace all % sign by an empty string.
Then check if the decimal sign is correct according to your settings (some 
may need a '.' other a ',').
Percentages are just number with some decimals, so you should consider them 
as numbers.

Good luck
Vincent


"gregperry" <u58729@uwe> schreef in bericht news:a4ebf397e3794@uwe...
> I am trying to import a .csv text file into access using an import
>
> specification and everytime I try to import the data I get a type
>
> conversion failure because there is no percentage data type that will
>
> recognize the values that are in the .csv file.
>
> Does anyone know how I can accomplish this import?  I am really
>
> wanting to automate this import process somehow using VBA and need to
>
> first get this data in the table.
>
>
> Any help would be greatly appreciated!!!
>
> Thanks in advance,
>
> Greg
> 
0
Reply vincent 3/28/2010 5:06:14 PM

Make sure no '%' sign is present in your csv file. If there are, use code to 
open the file line by line and replace all % sign with '' (=null string) 
using Replace(linx,'%','') or open the file manually and use the function 
'Replace' to do the same.
Also make sure that the decimal sign is correct in your csv file: try with a 
comma ',' or a dot '.' but it must be recognized as a decimal sign when 
importing.

Percentages are just numbers with 2 (or more) decimals. After importing in 
Access you can format the display with 2 or more decimals.

Good luck.
Vincent


"Bob Howard" <info@churchtrax.com> schreef in bericht 
news:um171p3wKHA.4492@TK2MSFTNGP05.phx.gbl...
> I import .csv text files into my application.  There's nothing special I 
> do about any of the data elements.  After reading each input record, I 
> simply parse it into a Variant array.  I then deal with each element, one 
> at a time.
>
> It would seem that if a specific element (Variant by that time) is a 
> percentage, you would deal with it accordingly.  The fact that it came 
> from a .csv text file is no longer a material matter.
>
> bob
>
> "gregperry" <u58729@uwe> wrote in message news:a4ebfa1fabd68@uwe...
>> The data field that I am trying to import that is causing the problems 
>> has
>> percent data in it.
>>
>> gregperry wrote:
>>>I am trying to import a .csv text file into access using an import
>>>
>>>specification and everytime I try to import the data I get a type
>>>
>>>conversion failure because there is no percentage data type that will
>>>
>>>recognize the values that are in the .csv file.
>>>
>>>Does anyone know how I can accomplish this import?  I am really
>>>
>>>wanting to automate this import process somehow using VBA and need to
>>>
>>>first get this data in the table.
>>>
>>>Any help would be greatly appreciated!!!
>>>
>>>Thanks in advance,
>>>
>>>Greg
>>
>
> 
0
Reply vincent 3/29/2010 4:52:14 PM

8 Replies
755 Views

(page loaded in 0.425 seconds)

Similiar Articles:
















7/26/2012 3:40:13 PM


Reply: