DoCmd.TransferText

ezfriend

Registered User.
Local time
Yesterday, 22:22
Joined
Nov 24, 2006
Messages
242
I have a table with couple fields and define as follow:

  • RecordID Number
  • Author MEMO
  • Recipient MEMO

File Format:
"RecordID","Author","Recipient"
2929929,"Author1,Author2,etc..","Recipient1,Recipient2,etc.."
2929930,"Author1,Author2,etc..","Recipient1,Recipient2,etc.."
2929931,"Author1,Author2,etc..","Recipient1,Recipient2,etc.."

The Author and Recipient field tend to have a super long list of names, depending on the file so I define the field as type MEMO. I don't plan to sort these two fields or anything. These names are just simply there as text.

When I run the import wizard, all data will be imported to the table correctly; however, when using the DoCmd.TransferText, some records in the Author and Recipient fields got truncated even when the field is define as MEMO.

FYI: I have quite a bit of files with the same data structure so I loop through all files within the directory and import them in using the following code.
The List items contain full path and file names of these text file.
CODE:

Dim i as long

For i=1 to lvFileName.ListItems.Count
DoCmd.TransferText acImportDelim, , "Data", lvFileName.ListItems.Item(i), True​
Next


Any idea of why the data get truncated?

Thanks.

ez.
 
Thanks qdogfball. I haven't found the solution to my problem yet, but will keep looking.

ez.
 
I finally ended up using a schema.ini file for this.

Using schema file seems to be a more logical approach.

sSQL = ""
sSQL = "SELECT * INTO tmpFile FROM " _
& "[Text;HDR=Yes;Database=" & txtDirectory & ";].TMP#TXT"

CurrentDb.Execute sSQL
 

Users who are viewing this thread

Back
Top Bottom