我有2个表,如下所示。我需要更新表[ASBUILT_LIST]的[incomming letter contractor]字段,其值为[tblTransmittalls]的 我使用了以下更新查询 现在,如果[DocumentNo]字段没有任何匹配(2个表之间相关),我需要将[包含字母承包商]更新为 当匹配时,它会像以前一样更新: 表格是: 表:ASBUILT_LIST 表:tblTransmittalls 我需要更新的ASBUILT_LIST表,因此在运行更新查询后,它应该是这样的:UPDATE ASBUILT_LIST INNER JOIN tblTransmittalls
ON ASBUILT_LIST.DOC=tblTransmittalls.DocumentNo
SET ASBUILT_LIST.[incomming letter contractor] = [tblTransmittalls]![TRANSMITTAL]
WHERE ((tblTransmittalls.PurposeofIssue)="FIN"));
NULL
值。SET ASBUILT_LIST.[incomming letter contractor] = Null
SET ASBUILT_LIST.[incomming letter contractor] = [tblTransmittalls]![TRANSMITTAL]
doc incomming letter contractor
------------------ ---------------------------
doc-1000 L-0001
doc-2000 L-0002
DocumentNo TRANSMITTAL PurposeofIssue
----------------- --------------- --------------
DOC-1000 T-0001 FIN
DOC-3000 T-0500 FIN
DOC-4000 T-0600 IFI
DOC-2000 T-0800 IFI
doc incomming letter contractor
------------- ---------------------------
doc-1000 T-0001
doc-2000 null
答案 0 :(得分:1)
如果我正确理解您的描述,DLookup()
。
UPDATE ASBUILT_LIST
SET [incomming letter contractor] =
DLookup
(
"TRANSMITTAL",
"tblTransmittalls",
"DocumentNo = '" & [DOC] & "' AND PurposeofIssue = 'FIN'"
);