Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 13th, 2005, 12:13 PM
eagleofjade
Guest
 
Posts: n/a
Default Carriage Return problems when importing from a Word document

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

  #2  
Old November 13th, 2005, 12:13 PM
Rich P
Guest
 
Posts: n/a
Default Re: Carriage Return problems when importing from a Word document

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 ***
  #3  
Old November 13th, 2005, 12:14 PM
eagleofjade
Guest
 
Posts: n/a
Default Re: Carriage Return problems when importing from a Word document

Thanks Rich, using the vbcrlf in place of the carriage returns does the
trick. I appreciate your help.

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles