ACC95: Yes/No Field Causes Error in AutoLookup QueryLast reviewed: May 22, 1997Article ID: Q142540 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. When you add a record in a form (or query datasheet) bound to an AutoLookup query, you may receive one of the following error messages:
Current field must match join key '?' on 'one' side of one-to-many relationship because it has been updated. -or To make changes to this field, first save the record. CAUSEThe AutoLookup query contains a Yes/No data type field from the "one" side table. For Yes/No fields, Microsoft Access automatically enters a 0 (zero) as the default value. Because the Yes/No field is from the "one" side table and has a hidden default value, Microsoft Access assumes that you are trying to add a record to the "one" side as well as to the "many" side, which generates the error messages.
RESOLUTIONThere are two possible workarounds for using a Yes/No field in an AutoLookup query. Your choice depends on whether you need to modify the Yes/No field in the "one" side table.
Method 1If you want to add records to the "many" side table, but only display (not modify) the Yes/No field from the "one" side table, you can work around the hidden default value for Yes/No fields by using an expression in the query grid. For example, you can replace a Yes/No field reference such as
FieldName: MyYes/Nowith the expression:
FieldName: Expr1: [MyYes/No]+0Because an expression is used to output the field instead of a direct reference, Microsoft Access does not try to set the value of the Yes/No field in the "one" side table when you add records to the AutoLookup query. A side-effect of this workaround is that you cannot modify the Yes/No field in the "one" side table.
Method 2CAUTION: This method involves modifying the design of the "one" side table. If your application has multiple queries, forms, reports, and modules based on the table, this change may affect their behavior. To avoid potential side-effects caused by the design change, you should use Method 1 as the resolution for this issue. If you need to modify the Yes/No field in the "one" side table and add records to the "many" side table, you can change the field's data type from Yes/No to Number. Then, you can set the field's FieldSize and Validation Rule properties to simulate the behavior of a Yes/No data type field. To do so, follow these steps:
STATUSMicrosoft has confirmed this to be a problem in Microsoft Access 7.0. This problem no longer occurs in Microsoft Access 97.
MORE INFORMATION
Steps to Reproduce Problem
REFERENCESFor more information about AutoLookup queries, search for "AutoLookup queries," and then "About AutoLookup queries that enter data automatically" using the Microsoft Access 97 Help Index. For information about the "Current field must match join key '?' on 'one' side of one-to-many relationship because it has been updated" error message in Microsoft Access 2.0), please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q116062 TITLE : ACC2: Adding Records to AutoLookup Form Generates Error ARTICLE-ID: Q148410 TITLE : ACC95: Microsoft Jet Database Engine 3.0 Reserved Errors List |
Additional query words: #3341
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |