Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / January 2006

Tip: Looking for answers? Try searching our database.

How limit # of characters allowed in Access memo field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Maxfield - 12 Oct 2005 06:56 GMT
In working with Access 2003, I want to disallow the scrolling of a memo
field, which happens automatically if you type beyond the last line.  
Limiting the # of lines would do as well.  Of course, either the # to use,
whether lines or characters, would depend upon the font, but since that can't
be changed by the end user, that would not pose a problem.
Allen Browne - 12 Oct 2005 07:11 GMT
You could use the techniques described in this article:
   http://allenbrowne.com/casu-04.html
at:
   http://allenbrowne.com/ser-34.html

It suggests a combination of the Change event and KeyPress event.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> In working with Access 2003, I want to disallow the scrolling of a memo
> field, which happens automatically if you type beyond the last line.
> Limiting the # of lines would do as well.  Of course, either the # to use,
> whether lines or characters, would depend upon the font, but since that
> can't
> be changed by the end user, that would not pose a problem.
thedroz - 07 Jan 2006 15:22 GMT
Hi Allen,

I followed your instructions, but cannot get the code to work.  I created a
module and copied your 2 subs.

I then went to the On Key Press control for the comment box and pasted this
in the event procedure:

Private Sub Comments_KeyPress(KeyAscii As Integer)
Call LimitKeyPress.LimitKeyPress
End Sub

I receive the following error:

Compile Error:
Argurment Not Optional

> You could use the techniques described in this article:
>     http://allenbrowne.com/casu-04.html
[quoted text clipped - 9 lines]
> > can't
> > be changed by the end user, that would not pose a problem.
Douglas J. Steele - 07 Jan 2006 18:47 GMT
You're not calling LimitKeyPress correctly.

As Allen's page states, "to limit a control named "City" to 40 characters,
its KeyPress event procedure is:

   Call LimitKeyPress(Me.City, 40, KeyAscii)"

That means you need:

Private Sub Comments_KeyPress(KeyAscii As Integer)
  Call LimitKeyPress(Me.Comments, 100, KeyAscii)
End Sub

to limit the input to 100 characters.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

> Hi Allen,
>
[quoted text clipped - 29 lines]
>> > can't
>> > be changed by the end user, that would not pose a problem.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.