Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import from Word into Access - Carriage Return Character

Status
Not open for further replies.

DaveTO

Programmer
Nov 18, 2002
9
CA
While browsing this forum, I found a great link to Import from Word into Access using a macro.


The file is "code8.zip" on this page.

Using this macro, I can read text from a table in Word and append it to a field in Access. The problem is that Access can not read the carriage return character properly. Mutiple lines in Word become one continous line in Access.

The character looks like "|" in bold. I am using "memo" as the field type in Access.

Suggestions would be appreciated.
 
I have to fix some text that is copied and pasted into a field by my users from word. It has tabs in it that print as | on my reports.

Here's the code: sInString is the text to be searched, sFindString is the character to find and sReplaceString is the character to replace it with. Chr(13) is a return.

Function fstrTran(ByVal sInString As String, _
sFindString As String, _
sReplaceString As String) As String
Dim iSpot As Integer, iCtr As Integer
Dim iCount As Integer

iCount = Len(sInString)
For iCtr = 1 To iCount
iSpot = InStr(1, sInString, sFindString)
If iSpot > 0 Then
sInString = Left(sInString, iSpot - 1) & _
sReplaceString & _
Mid(sInString, iSpot + Len(sFindString))
Else
Exit For
End If
Next
fstrTran = sInString

End Function

You are going to have to try to figure out the character code that is being imported from word. Testing various characters was the way that I found mine.

Here's my example: fstrTran([fieldname],Chr(9), Chr(13))
Trisha
padinka@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top