Importing text file into Access table

  • Thread starter Thread starter starlore
  • Start date Start date
S

starlore

I need to import a comma-delimited text file saved from a Word form
into an Access table. The problem is that all the number fields, even
though marked as number fields on the form, are saved as text strings
in the text file. When I try to parse and convert them into the
appropriate number types (long, double, integer), I am consistently
getting a "type mismatch" error. For example, the string "1504" won't
convert to a long data type. I have tried the following code to make
this work with no success (varValue(i) being the string "1504"):

varValue(i) = cLng(varValue(i))
lngValue = cLng(varValue(i))

Am I overlooking something obvious? TIA for any help with this.
 
I've had more success importing first into an excel spreadsheet, getting the
data types right there, then importing the spreadsheet into access.
 
Back
Top