PRA: "#" Character in Input Mask Causes Unexpected Behavior

    Article ID: Q116385
    Creation Date: 20-JUN-1994
    Revision Date: 19-SEP-1996

    The information in this article applies to:

    • Microsoft Access versions 2.0, 7.0

    SYMPTOMS

    Novice: Requires knowledge of the user interface on single-user computers.

    When you enter data in a text field that uses the "#" character as part of an input mask, spaces that you enter with the LEFT ARROW and RIGHT ARROW keys may not be converted properly when the record is saved.

    RESOLUTION

    There are two workarounds for this behavior:

    • Use the spacebar, instead of the LEFT ARROW and RIGHT ARROW keys, to move in the text field.
    • Change the InputMask property to save the field as it is displayed. To do this, add ";0" (without the quotation marks) to the end of the input mask in Design view. For example, given the input mask

            ###" Next Number"###" End"
      

      you can cause Microsoft Access to save the field as it is displayed by changing the input mask to:

            ###" Next Number"###" End";0
      

      Note that if you use this method, Microsoft Access stores the literal display characters in the table when you enter data.

    STATUS

    Microsoft has confirmed this to be a problem in Microsoft Access version 2.0 and 7.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

    MORE INFORMATION

    Steps to Reproduce Problem

    1. Start Microsoft Access and open any database.
    2. Create a new table (In version 7.0, when the New Table dialog appears, click Design View, and then click OK.
    3. Add a text field called Test Input Mask to the table. Set the field's input mask to the following:

            ###" Next Number"###" End"
      
    4. Save the table as 'TryMe' and then view it in Datasheet view (Do not be concerned with saving the table with a primary key).
    5. Type "1" (without the quotation marks) in the first entry position in
    the
       field. Press the RIGHT ARROW key twice to move the next entry position,
       and then type "1" (without the quotation marks) in the second entry
       position.
    
    
  • Press TAB to exit the field. Note that the data is saved as 11 Next Number End instead of 1 Next Number 1 End
  • If you press the SPACEBAR instead of the RIGHT ARROW key in the example above, the data will be saved correctly. Note that using the mouse to move from the first entry position to the second entry position will also cause the problem to occur. This problem occurs with both tables and forms.

    REFERENCES

    For more information about the InputMask property, search for "InputMask," and then "InputMask Property" using the Microsoft Access Help menu.


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
©1997 Microsoft Corporation. All rights reserved. Legal Notices.

Additional reference words: 2.00 7.00
KBCategory: kbusage kbdocerr
KBSubcategory: GnlInpt