Count lines in text box

G

Guest

Access 2003

I have a tex box to write long text.
I want to limit this text box based of number of lines.
Question.
How can I count the number of lines into a text box?

Thanks
jcp
 
G

Guest

Hi,
the function in the example (How to Display Line Nmbers on subform Reocrds)
doesn't do what I want. It shows record number

I would like to count the number of lines existing in the tex box.
Imagine you have a text box to write comments (data type is memo). You can
write 10 lines, 15 or what you want.
I want to limit until 20lines, because I'm developing a report and if we
write more than 20 lines, when we print the report, it gives more than one
page A4. So, the user should be resume the comments until 20 lines.

Do you have any idea?
Thanks

I would like to count this lines to limit until 50 lines
 
F

fredg

Hi,
the function in the example (How to Display Line Nmbers on subform Reocrds)
doesn't do what I want. It shows record number

I would like to count the number of lines existing in the tex box.
Imagine you have a text box to write comments (data type is memo). You can
write 10 lines, 15 or what you want.
I want to limit until 20lines, because I'm developing a report and if we
write more than 20 lines, when we print the report, it gives more than one
page A4. So, the user should be resume the comments until 20 lines.

Do you have any idea?
Thanks

I would like to count this lines to limit until 50 lines

Lines = Len([ControlName])-Len(Replace([ControlName],Chr(10),""))+1
 
G

Guest

Thanks Fredg,
Your function count paragraphs and not lines. For example, if I have two
paragraphs and each one with 5 lines the result is 2 and not 10.
Do you have idea to count lines?
I think is possible but I don't have idea.

jcp

--
Jose


fredg said:
Hi,
the function in the example (How to Display Line Nmbers on subform Reocrds)
doesn't do what I want. It shows record number

I would like to count the number of lines existing in the tex box.
Imagine you have a text box to write comments (data type is memo). You can
write 10 lines, 15 or what you want.
I want to limit until 20lines, because I'm developing a report and if we
write more than 20 lines, when we print the report, it gives more than one
page A4. So, the user should be resume the comments until 20 lines.

Do you have any idea?
Thanks

I would like to count this lines to limit until 50 lines

Lines = Len([ControlName])-Len(Replace([ControlName],Chr(10),""))+1
 
S

Stephen Lebans

THe simplest method is to use a fixed width font(Courier) and set the max
characters for the underlying field. If this is not acceptable then see:
http://www.lebans.com/limittextinput.htm
New Version 2.0 LimitTextInput.zip is a database containing a function to
limit the input into a TextBox control. Will allow data input that will fit
within the current displayable area of the control only. Handles both
Keyboard and Mouse events. Includes a self contained function to mimic the
Report objects TextHeight method.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


JCP said:
Thanks Fredg,
Your function count paragraphs and not lines. For example, if I have two
paragraphs and each one with 5 lines the result is 2 and not 10.
Do you have idea to count lines?
I think is possible but I don't have idea.

jcp

--
Jose


fredg said:
Hi,
the function in the example (How to Display Line Nmbers on subform
Reocrds)
doesn't do what I want. It shows record number

I would like to count the number of lines existing in the tex box.
Imagine you have a text box to write comments (data type is memo). You
can
write 10 lines, 15 or what you want.
I want to limit until 20lines, because I'm developing a report and if
we
write more than 20 lines, when we print the report, it gives more than
one
page A4. So, the user should be resume the comments until 20 lines.

Do you have any idea?
Thanks

I would like to count this lines to limit until 50 lines

Lines = Len([ControlName])-Len(Replace([ControlName],Chr(10),""))+1
 
G

Guest

Thanks a lot Lebans,
Your code give me a solution.

jcp
--
Jose


Stephen Lebans said:
THe simplest method is to use a fixed width font(Courier) and set the max
characters for the underlying field. If this is not acceptable then see:
http://www.lebans.com/limittextinput.htm
New Version 2.0 LimitTextInput.zip is a database containing a function to
limit the input into a TextBox control. Will allow data input that will fit
within the current displayable area of the control only. Handles both
Keyboard and Mouse events. Includes a self contained function to mimic the
Report objects TextHeight method.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


JCP said:
Thanks Fredg,
Your function count paragraphs and not lines. For example, if I have two
paragraphs and each one with 5 lines the result is 2 and not 10.
Do you have idea to count lines?
I think is possible but I don't have idea.

jcp

--
Jose


fredg said:
On Wed, 29 Aug 2007 03:58:00 -0700, JCP wrote:

Hi,
the function in the example (How to Display Line Nmbers on subform
Reocrds)
doesn't do what I want. It shows record number

I would like to count the number of lines existing in the tex box.
Imagine you have a text box to write comments (data type is memo). You
can
write 10 lines, 15 or what you want.
I want to limit until 20lines, because I'm developing a report and if
we
write more than 20 lines, when we print the report, it gives more than
one
page A4. So, the user should be resume the comments until 20 lines.

Do you have any idea?
Thanks

I would like to count this lines to limit until 50 lines

Lines = Len([ControlName])-Len(Replace([ControlName],Chr(10),""))+1
 

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

Top