473,663 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I remove hard returns (CR + LF) in a memo field string?

MLH
I use A97. I want to remove carriage return / linefeed pairs
from a memo field. How can I strip a string of these special,
non-printing characters?
Nov 13 '05 #1
2 5173
On Fri, 19 Aug 2005 14:43:01 -0400, MLH wrote:
I use A97. I want to remove carriage return / linefeed pairs
from a memo field. How can I strip a string of these special,
non-printing characters?


In Access 97 you'll need to write a User Defined function.

Copy and Paste the following into a Module

Change the Error Handling as needed.

Function StripReturns(St rIn As String) As String

On Error GoTo Err_Handler

Dim intX As Integer
Dim strName As String
Dim strNewName As String
Dim strY As String

strName = StrIn
For intX = 1 To Len(strName)
strY = Mid(strName, intX, 1)
If (Asc(strY) <> 13 And Asc(strY) <> 10) Then
strNewName = strNewName & strY
End If
Next intX
StripReturns = strNewName

Exit_StripRetur ns:
Exit Function

Err_Handler:
MsgBox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_StripRetur ns
End Function
============

Call it from a query:
NewColumn:IIf(N ot IsNull([FieldName]),StripReturns([FieldName]),"")

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2
MLH
Thx FredG
xxxxxxxxxxxxxxx xxxxx

On Fri, 19 Aug 2005 12:34:06 -0700, fredg <fg******@examp le.invalid>
wrote:
On Fri, 19 Aug 2005 14:43:01 -0400, MLH wrote:
I use A97. I want to remove carriage return / linefeed pairs
from a memo field. How can I strip a string of these special,
non-printing characters?


In Access 97 you'll need to write a User Defined function.

Copy and Paste the following into a Module

Change the Error Handling as needed.

Function StripReturns(St rIn As String) As String

On Error GoTo Err_Handler

Dim intX As Integer
Dim strName As String
Dim strNewName As String
Dim strY As String

strName = StrIn
For intX = 1 To Len(strName)
strY = Mid(strName, intX, 1)
If (Asc(strY) <> 13 And Asc(strY) <> 10) Then
strNewName = strNewName & strY
End If
Next intX
StripReturns = strNewName

Exit_StripRetu rns:
Exit Function

Err_Handler:
MsgBox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_StripRetur ns
End Function
============

Call it from a query:
NewColumn:IIf( Not IsNull([FieldName]),StripReturns([FieldName]),"")


Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8667
by: Alfredo Agosti | last post by:
Hi folks, I have an Access 2000 db with a memo field. Into the memo field I put text with bold attributes, URL etc etc What I need to to is converting the rich text contained into the memo field in plain text. That's because I truncate the string text but if, when I truncate it there's a rich tag the code following the truncated string is corrupted. Don't know if it's clear enough.
3
2028
by: Dave | last post by:
I need to strip out carriage returns from a memo field. Basically, one of the commercial databases we have uses a memo field for the address, and what I'd like to do is get rid of the carriage returns so I can have the address on a single line (possibly separated by commas) in a different database. Any suggestions gratefully received. Apologies if you replied to this earlier, I think my ISP must have dropped the newsgroup a week or two...
3
3023
by: John | last post by:
I have a field, data type Memo, in a job details table. I have a text box on a report which I need to print the contents of this field. My problem is that the text box will only display 255 characters. How can I get the report to print this field completely. Thanks for any help out there. John.
6
1675
by: MLH | last post by:
SELECT Adresses.RawData FROM Adresses WHERE (((Adresses.RawData)=InStr(1,,Chr$(13)))); Its not doing the trick for me and I'm not sure why.
10
4578
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac11/html/acfctNZ_HV05186465.asp "If the value of the variant argument is Null, the Nz function returns the number zero or a zero-length string (always returns a zero-length string when used in a query expression)" **** How many records are there in FirstTable in which Product Is Null. SELECT COUNT(*) AS CountofNullProdcut
1
3034
by: alexsg | last post by:
A little while ago Ron P kindly responded to my inquiry on how to copy the first line of memo field into a text field, using a query: left(,instr(1,,vbCrLf)-1) This is great, but I would like to do this on a form, so that the person entering the memo can use a button to paste the 1st line to a title (text) field. I'm having trouble setting up the code to do this. I'd also appreciate some ideas on how to get the 2nd and 3rd lines...
3
10011
by: Gillian Steele | last post by:
I'm trying to import data into a memo field by running an append query. The data is to be imported as if it was entered with separate lines in the memo field. I have tried inserting chr(13)s into the string that is being appended into the memo field but when appended, the data displays with a square box in place of a carriage return/line feed. I would like to import the data so that data is displayed in separate lines within the memo...
9
5731
by: RMC | last post by:
Hello, I'm looking for a way to parse/format a memo field within a report. The Access 2000 database (application) has an equipment table that holds a memo field. Within the report, the memo field is printed within the detailed area. The problem is, the apllication is not setup properly, thus the users are entering data within the memo field as: location1 1/1/2005 1/1/2006
11
3727
tdw
by: tdw | last post by:
Hi all, I have tried a few different methods to accomplish this, but with no luck. I will post the code for the latest attempt at the end of this post. I work at a land surveying company. This database is for tracking survey orders. One of the fields is for entering the Subdivision that the parcel of land is in. That field on the New Orders entry form is called "SUB_NAME". On that form it is a combo box that uses a seperate table called...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.