Table of contents

未定义字段时不能追加关系。(错误 3366)Cannot append a relation with no fields defined. (Error 3366)

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

适用于:访问 2013年 |访问 2016 年Applies to: Access 2013 | Access 2016

要追加的关系对象到关系集合,但关系对象不包含字段。You are trying to append a Relation object to a Relations collection, but the Relation object has no fields.

正确追加 Relation 的方法To correctly append a Relation

  1. 使用CreateRelation方法创建关系对象。如果您未指定它们作为CreateRelation方法的参数,设置外表关系对象,此对象的属性属性。使用CreateField方法在关系的主键和外键创建新的字段对象的每个字段。Use the CreateRelation method to create the Relation object. Set the Table, ForeignTable, and Attributes properties of the Relation object, if you did not specify them as arguments to the CreateRelation method. Use the CreateField method to create a new Field object for each field in the primary and foreign keys of the relationship.

  2. 设置的名称(如果您没有指定它作为CreateField方法的参数) 和ForeignName属性或多个对象的主键值对应的名称属性设置为与该关系中每个字段的外键字段对象。Set the Name (if you did not specify it as an argument to the CreateField method) and ForeignName properties of the Field object or objects to the corresponding Name property settings of the primary key and the foreign key Field objects of each field in the relationship.

  3. 使用Append方法可以保存的对象关系对象的字段集合中。Use the Append method to save the Field object or objects in the Fields collection of the Relation object.

  4. 使用Append方法可以保存到关系数据库中关系对象。Use the Append method to save the Relation object in the Relations collection of the database.

访问 MSDN 上的开发人员论坛Access for developers forum on MSDN 的访问帮助Access help on 的访问帮助Access help on
特定的访问权限错误代码,在 Bing 上搜索Search for specific Access error codes on Bing
访问论坛 UtterAccess 上Access forums on UtterAccess
访问 wiki 上 UtterAcessAccess wiki on UtterAcess
访问开发人员和 VBA 编程帮助中心 (FMS)Access developer and VBA programming help center (FMS)
在 StackOverflow 上访问张贴内容Access posts on StackOverflow

© 2018 Microsoft