Type Conversion Failure!!!!


G

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
 
G

gregperry

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

Advertisements

B

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
 
C

celeste

gregperry said:
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
 
G

gregperry via AccessMonster.com

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 said:
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]
 
G

gregperry via AccessMonster.com

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.
i can help you
I am trying to import a .csv text file into access using an import
[quoted text clipped - 15 lines]
 
V

vincent

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
 
Ad

Advertisements

V

vincent

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Conversion Failure? 8
Import Text (CSV) Type Conversion Failure 2
Access type conversion error 1
conversion 1
conversion 1
Conversion 0
Conversion 3
conversion 1

Top