Solved Issues importing data with correct format (1 Viewer)

NahualXl

New member
Local time
Today, 16:03
Joined
Sep 23, 2021
Messages
19
Hello,
I am executing the following command (operator enters the file number to be imported and press a button):
Code:
DoCmd.TransferText TransferType:=acLinkDelim, tableName:="CsvTbl", _
    FileName:="E:\Op60\" + MyTbl + Myextension, HasFieldNames:=True
to open a desired CSV (I have 100s of different files) file (generated automatically elsewhere), just realized there is an issue when importing a column named "DATA".
This field contains either numbers 1.0, 0.056 etc. or letters A, or B.
When the import operation takes place this field gets automatically formatted as Numeric, and where a letter value is found displays "#Num!" instead.
The import operation creates a linked table from each file opened, thus making it impossible for me to edit the field and correct the formatting.
If any one has any ideas as to how to correct this or another solution I'd appreciate it so much.
Thank you
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 13:03
Joined
Oct 29, 2018
Messages
21,453
Hi. Have you tried creating/using an import specification?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:03
Joined
Feb 19, 2002
Messages
43,213
Without a specific importSpec, Access reads the first 30 or so rows of data. If ALL the values in column4 are numeric, Access assumes that all rows contain numbers. If there is a mix, Access assumes a text data type. This is what you are running into and why your import may work occassionally but not other times.
 

Users who are viewing this thread

Top Bottom