问题描述
Hello all,
Hello all,
我有两个相关的表,其中包含"强制数据完整性"。已启用。
I have two related tables with "enforce data integrity" enabled.
TBL_A
[PK] LinkingID [自动编号]
FieldA1
$
FieldA2
TBL_A
[PK] LinkingID [AutoNumber]
FieldA1
FieldA2
TBL_B
[PK] BIndex
[ FK] LinkingID [Long Integer]
FieldB1
FieldB2
TBL_B
[PK] BIndex
[FK] LinkingID [Long Integer]
FieldB1
FieldB2
QRY_COMBINE (SELECT查询)
BIndex
TBL_A.LinkingID
FieldA1
FieldA2
FieldB1
FieldB2
QRY_COMBINE (SELECT query)
BIndex
TBL_A.LinkingID
FieldA1
FieldA2
FieldB1
FieldB2
QRY_COMBINE是一个SELECT查询FROM TBL_A LEFT JOIN TBL_B on TBL_A.LinkingID = TBL_B.LinkingID。
QRY_COMBINE is a SELECT query FROM TBL_A LEFT JOIN TBL_B on TBL_A.LinkingID = TBL_B.LinkingID.
对于现有记录,QRY_COMBINE正确显示两个基础表的组合数据。
For existing records, QRY_COMBINE correctly shows the combined data from both underlying tables.
当我尝试使用QRY_COMBINE创建新记录时,会在两个表中创建新记录。 在新记录中,输入FieldA1,FieldA2,FieldB1,FieldB2中的查询的数据被正确存储到其基础表中。
When I try to create a new record using QRY_COMBINE, new records are created in both tables. On a new record, data entered into the query in FieldA1, FieldA2, FieldB1, FieldB2, are correctly stored to their underlying tables.
TBL_A中的新记录具有新生成的自动编号,但是TBL_B中新记录的FK LinkingID字段永远不会填充新生成的TBL_A的LinkingID。 相反,TBL_B的LinkingID字段保持空白,并且重新运行
查询将不显示FieldA1,FieldA2,因为两个表之间没有共同的LinkingID。
The new record in TBL_A has a newly generated AutoNumber, but the FK LinkingID field of the new record in TBL_B is never populated with the with the newly generated LinkingID of TBL_A. Instead, the LinkingID field of TBL_B remains blank, and a re-running the query will not display FieldA1, FieldA2 because there is no common LinkingID between the two tables.
有没有办法让Access在QRY_COMBINE中创建记录时自动链接两条记录?
Is there a way to get Access to automatically link the two records on record creation in QRY_COMBINE?
感谢您的帮助。
推荐答案
这篇关于SELECT查询在相关表中生成新记录,但不链接外键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!