Discussion:
Type Conversion Failure!!!!
(too old to reply)
gregperry
2010-03-13 00:35:01 UTC
Permalink
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
gregperry
2010-03-13 00:38:02 UTC
Permalink
The data field that I am trying to import that is causing the problems has
percent data in it.
Post by gregperry
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
Bob Howard
2010-03-14 13:31:55 UTC
Permalink
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
Post by gregperry
The data field that I am trying to import that is causing the problems has
percent data in it.
Post by gregperry
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
gregperry via AccessMonster.com
2010-03-25 22:14:06 UTC
Permalink
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.
Post by Bob Howard
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
Post by gregperry
The data field that I am trying to import that is causing the problems has
percent data in it.
[quoted text clipped - 18 lines]
Post by gregperry
Greg
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-conversion/201003/1
vincent
2010-03-29 16:52:14 UTC
Permalink
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
Post by Bob Howard
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
Post by gregperry
The data field that I am trying to import that is causing the problems has
percent data in it.
Post by gregperry
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
skarlet
2010-03-24 00:36:14 UTC
Permalink
i can help you
Post by gregperry
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
gregperry via AccessMonster.com
2010-03-25 22:16:46 UTC
Permalink
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.
Post by skarlet
i can help you
Post by gregperry
I am trying to import a .csv text file into access using an import
[quoted text clipped - 15 lines]
Post by gregperry
Greg
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-conversion/201003/1
celeste
2010-03-25 09:16:30 UTC
Permalink
Post by gregperry
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
vincent
2010-03-28 17:06:14 UTC
Permalink
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
Post by gregperry
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
Continue reading on narkive:
Loading...