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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count Line Breaks in Memo Field 1

Status
Not open for further replies.

BattleDroid42

Programmer
May 17, 2002
100
US
How would I count the number of line breaks/returns in the text of a memo field?
 
Something like this ?
(Len(MemoField) - Len(Replace(MemoField, vbCrLf, ""))) / Len(vbCrLf)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
If you're using A2K or later, then you could try using the Split function on the memo field, using vbCrLf as the delimiter. Then you can determine the number of returns as the UBound(TheArray) - 2.

Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Access assumes that vbCrLf is a field name and places brackets around it. I was hoping to be able to do this in a query rather than in code.
 
And this ?
(Len(MemoField) - Len(Replace(MemoField, Chr(13) & Chr(10), ""))) / 2)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top