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

Carriage Return problems when importing from a Word document

P: n/a
I am trying to import data from a Word document into an Access table
with VBA.

The Word document is a form which has various fields. One of the fields
is a field for notes. In some cases, this note field contains carriage
returns.

When I import a note field that has carriage returns, what shows up in
the Access field are vertical black lines where the carriage return
should be.

I have done searches on this problem, and seen a number of "solutions",
one from Microsoft suggests turning the carriage returns into tabs,
another solution simply eliminates the carriage returns altogether.

I have tried using the instr() function to identify where the carriage
returns are in the field, then replacing them with vbCr and VbLf to
place them in the field, but it still puts the black bar in their
place. I know from my reading that Access interprets the carriage
returns as delimiters, but does anyone know a way to import a field
with carriage returns in it without getting the black lines and
actually showing the line breaks?

Thanks

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can fix this problem in 2 steps. In the first step you import your
text and parse out the carriage returns with the Instr() function. You
need to record the values where the carriage returns occurred. Now
store your text as one string in a table. Then recreate the string
(step 2) and apply vbcrlf per the values you recorded in step 1. Write
this new string to its intended destination. This may seem tedious, but
if you want a programmatic solution, this is one solution.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #2

P: n/a
Thanks Rich, using the vbcrlf in place of the carriage returns does the
trick. I appreciate your help.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.