ACC: Can't Paste Append Using Input Mask Based on Short Date

Last reviewed: May 14, 1997
Article ID: Q160575
The information in this article applies to:
  • Microsoft Access versions 7.0, 97

SYMPTOMS

Moderate: Requires basic macro, coding, and interoperability skills.

When you use the Paste Append command to append a record in Form view of a form containing a control with any variation of the Short Date in its InputMask property, the appended record contains a Null value in that control.

The Short Date format appears in the InputMask property as something resembling "99/99/00;0;_".

RESOLUTION

There a three workarounds:

  • Change the control's InputMask property from Short Date to a different input mask, such as Medium Date.
  • Open the form in Datasheet view before you execute the Paste Append command.
  • Write code to temporarily move the control's input mask to a form level variable before you execute Paste Append, and then reassign the input mask from the variable to the control's InputMask property using the OnEnter property of the control.

Follow these steps to implement the third workaround:

The following example assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.

CAUTION: Following the steps in this example will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file, or perform these steps on a copy of the Northwind.mdb database.

  1. Start Microsoft Access and open the sample database Northwind.mdb.

  2. Open the Employees (page break) form in Design view (or the Employees form in version 7.0).

  3. Select the HireDate text box control, and then view its properties.

  4. Click the Build button next to the InputMask property to invoke the Input Mask Wizard. Click Short Date, and then click Finish.

  5. On the View menu, click Code.

  6. Type the following line in the Declarations section of the form module:

          Dim mstrIMask As String
    

  7. Type the following procedures:

          Private Sub Form_BeforeInsert(Cancel As Integer)
    
             mstrIMask = Me!HireDate.InputMask
             Me!HireDate.InputMask = ""
          End Sub
    
          Private Sub HireDate_Enter()
             If mstrIMask <> "" Then Me!HireDate.InputMask = mstrIMask
          End Sub
    
    

  8. Close the form module and switch to Form view.

  9. On the Edit menu, click Select Record.

  10. On the Edit menu, click Copy.

  11. On the Edit menu, click Paste Append.

  12. On the Edit menu, point to Go To and then click Last. Note that the

        HireDate value is appended correctly.
    

STATUS

Microsoft has confirmed this to be a problem in Microsoft Access 7.0 and 97. 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

CAUTION: Following the steps in this example will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file, or perform these steps on a copy of the Northwind.mdb database.

  1. Perform steps 1-4 in the "Resolutions" section of this article.

  2. Switch the form to Form view.

  3. On the Edit menu, click Select Record.

  4. On the Edit menu, click Copy.

  5. On the Edit menu, click Paste Append.

  6. On the Edit menu, point to GoTo and then click Last. Note that the HireDate field is empty.

REFERENCES

For more information about input masks, search the Help Index for

"InputMask property," or ask the Microsoft Access 97 Office Assistant.


Keywords : FmsProb GnlDe GnlInpt kbusage
Version : 7.0 97
Platform : WINDOWS
Hardware : X86
Issue type : kbbug
Resolution Type : kbworkaround


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.

Last reviewed: May 14, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.