ms访问语法错误列规范无效(#0)

时间:2013-04-17 10:28:30

标签: ms-access ms-access-2007 access-vba

我正在进行两个查询的联合。

查询单独运行时没有问题,但联合会抛出此查询。有任何想法吗?

查询

SELECT CStr([REFERENCE])AS CostID,CSng([RATE])AS HRates FROM [Qry 1项目预算pt1人工费率] UNION ALL SELECT CStr([REFERENCE]),CSng([Rate])FROM [Qry 1 Project Budget pt2 3rd party];

访问2007

1 个答案:

答案 0 :(得分:1)

CStr()CSng()都会在Null中引发错误。检查您的[REFERENCE][RATE]值是否为空。

SELECT
    [REFERENCE],
    [RATE]
FROM [Qry 1 Project Budget pt1 labour rates]
WHERE [REFERENCE] Is Null OR [RATE] Is Null
UNION ALL
SELECT
    [REFERENCE],
    [Rate]
FROM [Qry 1 Project Budget pt2 3rd party]
WHERE [REFERENCE] Is Null OR [RATE] Is Null;