By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,157 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

HOWTO import *long* text fields from a csv file ?

P: n/a
Hi. I got a "|" delimited file, and one of its columns (the last one)
is MANY chars long.

If I use my try to manually import the file, the text in the last
column is cut off at char 255, as it should.

I have tried to import it by code - I have created a target table in
Access where the "LongText" field, the last one, is of type Memo. Then
I have tried to open the text file with an OpenDatabase command, then
go thru the recordset returned by Opendatabase, and for each record
build a query string like "Insert Into Table1 values (.....)", but the
problem is that my OpenDatabase(Dir, FileName..) line does not work
properly - all 4 fields are all together in my first field, Fields(0),
while the last three fields are empty - this is because of the "|"
delim, I suppose, because the code runs fine when trying a ","
delimited table.

How can I import such a file, please (by code or manually) ?

Thanks a lot.
Alex.

May 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
YOu can actually do this pretty easily, using the first method you were
trying, with one trick:

Go ahead and do the import, suffering the loss of the characters in the long
field. Now open the imported table and delete all the rows. Put the table
in design view and change the field that needs to be bigger to a Memo field.
Save and close the table.

Re-do your import, but this time be careful to APPEND to an existing table,
not create a new table. You will wipe out your change. When you export,
appending to the existing table, with the Memo field you created, you'll get
your long text, assuming it's less than 32K characters. I think that's
still the limit of a memo field.

There's another way, actually easier, that gets it done in one pass, if
you're comfortable with the import dialog. In the first screen of the
Import Text Wizard there is a button at bottom left called "Advanced".
Click that to open a specification where you can force the kind of field you
want during the import. If your file has no field names on the first row,
and there are lots of fields, this can be hard to use. (Hmmmm...was it F23
or F24 that needed to be longer?)

ANyway, one of these will certainly do the job.

Rick
May 25 '06 #2

P: n/a
Thank you very much. That did the trick :-))

Alex

May 30 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.