[AccessD] Restrict the number of lines in a text box.

rockysmolin at bchacc.com rockysmolin at bchacc.com
Sat Jul 5 10:37:15 CDT 2008


Tony:

You could probably check each keystroke by calling your cahck routine from
the OnChange event.  Or maybe the KeyDown or KeyPress event with
KeyPreview=True.

R


Original Message:
-----------------
From: Tony Septav iggy at nanaimo.ark.com
Date: Sat, 05 Jul 2008 07:45:42 -0700
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Restrict the number of lines in a text box.


Hey Rocky
Thanks for the reply.  Basically what I figured.
What I figure on doing is using the old Access97 code (it needs 
modifying) to get the maximum characters for the text box width and 
multiply that by the number of lines. That way I can first run a check 
to see what is happening if the user is just simply typing text (no 
carriage return or line feed).
If it passes the test then check and count the number  CR and/or LF if 
they exceed the number of lines -1 then trap it and warn the user.  I 
think that should work. Just didn't want to reinvent the wheel if there 
was something already out there.

rockysmolin at bchacc.com wrote:

>Couldn't you just use that code and multiply the number of characters in
>one line by the number of lines?  
>
>You'd have to adjust the routine to also count hard returns so that, if you
>wanted to restric tthe text box to three lines the user can't enter four
>short lines.
>
>You'vre also got to account for different fonts having different character
>widths.
>
>Interesting problem.  Maybe you can post the solution.
>
>Rocky
>
>
>Original Message:
>-----------------
>From: Tony Septav iggy at nanaimo.ark.com
>Date: Sat, 05 Jul 2008 06:51:11 -0700
>To: accessd at databaseadvisors.com
>Subject: [AccessD] Restrict the number of lines in a text box.
>
>
>Hey All
>Does anyone know how to restrict the number of lines in a text box?
>I found some old Access97 code to restrict the numbers of characters to 
>the width of the text box.
>
>Thanks
>  
>

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


--------------------------------------------------------------------
mail2web.com – What can On Demand Business Solutions do for you?
http://link.mail2web.com/Business/SharePoint






More information about the AccessD mailing list