ACC2: "#Name?" Error with SQL Server Tables and Main/Subform

Last reviewed: May 20, 1997
Article ID: Q129464
2.00 WINDOWS kbusage kberrmsg

The information in this article applies to:

  • Microsoft Access version 2.0

SYMPTOMS

If you move to a new record on a main form when both the main form and its subform are based on attached SQL Server tables, you may receive the following error message:

   Duplicate value in index, primary key, or relationship. Changes were
   unsuccessful.

You receive this message even if you do not enter a duplicate value. Following the error message, the records on the subform are populated with the "#Name?" error message.

CAUSE

This behavior can occur when you set both the LinkMasterfields and LinkChildFields properties of the main form's subform control to linking fields that have the Integer data type and do not allow null values.

RESOLUTION

To work around this behavior, change the subform's linking field so that it accepts null values in the underlying table. Even though the table accepts null values, you can prevent users from entering them using one of the following methods in the main/subform:

  • Use Access Basic code in the subform's BeforeUpdate event procedure to check for null values in the linking field.
  • Create an insert trigger in the SQL server database to check for null values in the field before inserting the record.


Additional query words: pound poundname
Keywords : kberrmsg kbusage OdbcSqlms
Version : 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


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 20, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.