The information in this article applies to:
SUMMARY
Moderate: Requires basic macro, coding, and interoperability skills.
MORE INFORMATIONYou can limit the number of characters that can be typed into an unbound text box control in one of the following ways. Method 1You can specify an InputMask property setting. This is by far the simplest method. For example, a text box with the following InputMask property setting will limit the number of characters entered into a text box to 5:Input Mask: CCCCC Method 2You can use a Visual Basic for Applications function (or an Access Basic function in Microsoft Access version 2.0) called from the KeyPress event.Although an InputMask is easy to implement, it may be tedious and error prone to use if you need to limit the number of characters to a much larger value, like 50 characters. To limit the number of characters typed into a text box to 50 characters, create the following function in a global module:
Call the LimitFieldSize procedure from the KeyPress event of each unbound
text box control that you want to limit. You must pass the KeyAscii
parameter supplied by the KeyPress event and the number of characters you
want to limit typing to:
REFERENCESFor more information about KeyPress event, search the Help Index for "KeyPress Event," or ask the Microsoft Access 97 Office Assistant. Additional query words:
Keywords : kbusage FmsHowto |
Last Reviewed: October 13, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |