我有两张桌子。在UniqueZips表中,分配了一个代码字段,
我的目标是匹配两个表中每个窗口的字段,并将Uniquezips表中的代码分配给Route tbl,但下面的代码不起任何建议吗?
UPDATE [Route tbl], UniqueZips
SET [Route tbl].CODE = [UniqueZips]![CODE]
WHERE (([Route tbl]![WINDOW 1]=[UniqueZips]![WINDOW 1] &
[Route tbl]![WINDOW 2]=[UniqueZips]![WINDOW 2] &
[Route tbl]![WINDOW 3]=[UniqueZips]![WINDOW 3] &
[Route tbl]![WINDOW 4]=[UniqueZips]![WINDOW 4] &
[Route tbl]![WINDOW 5]=[UniqueZips]![WINDOW 5]));
我也厌倦了这个
UPDATE UniqueZips
INNER JOIN [Route tbl] ON (UniqueZips.[WINDOW 3] = [Route tbl].[WINDOW 3])
AND (UniqueZips.[WINDOW 5] = [Route tbl].[WINDOW 5])
AND (UniqueZips.[WINDOW 4] = [Route tbl].[WINDOW 4])
AND (UniqueZips.[WINDOW 2] = [Route tbl].[WINDOW 2])
AND (UniqueZips.[WINDOW 1] = [Route tbl].[WINDOW 1])
SET [Route tbl].CODE = [UniqueZips]![CODE]
WHERE ((([Route tbl]![WINDOW 1]=[UniqueZips]![WINDOW 1]
& [Route tbl]![WINDOW 2]= [UniqueZips]![WINDOW 2]
& [Route tbl]![WINDOW 3]=[UniqueZips]![WINDOW 3]
& [Route tbl]![WINDOW 4]=[UniqueZips]![WINDOW 4]
& [Route tbl]![WINDOW 5])=[UniqueZips]![WINDOW 5]));
好的,所以在我没有得到任何结果之前,但现在我已经尝试了这个
UPDATE [Route tbl], UniqueZips
SET [Route tbl].CODE = [UniqueZips]![CODE]
WHERE (((StrComp([Route tbl]![WINDOW 1],[UniqueZips]![WINDOW 1]) &
StrComp([Route tbl]![WINDOW 2],[UniqueZips]![WINDOW 2]) &
StrComp([Route tbl]![WINDOW 3],[UniqueZips]![WINDOW 3]) &
StrComp([Route tbl]![WINDOW 4],[UniqueZips]![WINDOW 4]) &
StrComp([Route tbl]![WINDOW 5],[UniqueZips]![WINDOW 5]))="0"));
然而这与他们匹配,但不正确,对所有这些混乱的任何帮助?
答案 0 :(得分:2)
请不要踢得太厉害......
我认为使用关键字&
替换字符串连接运算符AND
后,前两个将完美运行。