Counting Newlines

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a memo filed wher a user can enter text, including new lines (hard
returns). I want to be able to count how many times a new line/hard return
has been entered.

Does anyone out there in the land of know have any idea as to how I can do
this please. :-)
 
Headley said:
I have a memo filed wher a user can enter text, including new lines
(hard returns). I want to be able to count how many times a new
line/hard return has been entered.

Does anyone out there in the land of know have any idea as to how I
can do this please. :-)

This is a bit of overkill, but it's simple:

LineBreaks = UBound(Split([YourMemoField], vbCrLf))

or

LineCount = UBound(Split([YourMemoField], vbCrLf)) + 1

If the field may be Null, you have to allow for that:

LineCount = UBound(Split([YourMemoField] & "", vbCrLf))

An empty or Null field will then yield LneCount = 0.
 
You are a diamond geeza :-))))

Now I can count those darstardly evasive newlines.

Thanks Dirk

Dirk Goldgar said:
Headley said:
I have a memo filed wher a user can enter text, including new lines
(hard returns). I want to be able to count how many times a new
line/hard return has been entered.

Does anyone out there in the land of know have any idea as to how I
can do this please. :-)

This is a bit of overkill, but it's simple:

LineBreaks = UBound(Split([YourMemoField], vbCrLf))

or

LineCount = UBound(Split([YourMemoField], vbCrLf)) + 1

If the field may be Null, you have to allow for that:

LineCount = UBound(Split([YourMemoField] & "", vbCrLf))

An empty or Null field will then yield LneCount = 0.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top