没有为所需参数提供值 [英] No value given for the required parameter

查看:88
本文介绍了没有为所需参数提供值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对访问数据库运行下面的qry,但我收到错误消息是否没有为所需参数提供值?

I am trying to run the qry below against an access database and I get an error No value Given for the required parameter?

SELECT        ID, DateColumn, Less90, Between90180, Between180365, GreaterThan365, SUM(Less90) + SUM(Between90180) + SUM(Between180365) + SUM(GreaterThan365) 
                     AS Total, SUM(Between180365) / Total AS Expr1,
                         (SELECT        SUM(Between180365) / (SUM(Less90) + SUM(Between90180) + SUM(Between180365) + SUM(GreaterThan365))
                           FROM            tblHandpieceFaliuresAge T2
                           WHERE        T2.ID <= tblHandpieceFaliuresAge.ID) AS RunningSum
FROM            tblHandpieceFaliuresAge
GROUP BY ID, DateColumn, Less90, Between90180, Between180365, GreaterThan365

推荐答案

您错误地键入了其中一列,Access认为您正在尝试传递参数.

You have typed one of your columns incorrectly, and Access thinks you are trying to pass a parameter.

再次查看您的字段名称,并确保已正确输入所有字段名称.

Go over your field names again and make sure they have all been entered correctly.

我相信问题可能是这样的:

I believe the problem may be this:

SUM(Less90) + SUM(Between90180) + SUM(Between180365) + SUM(GreaterThan365) 
                 AS Total

然后在以后将其称为Total:

SUM(Between180365) / Total

访问不能使用别名并在查询中重新使用它,您需要这样做:

Access can't take the alias and re-use it in the query, you need this:

SUM(Between180365) / 
    (SUM(Less90) + SUM(Between90180) + SUM(Between180365) + SUM(GreaterThan365))

还要确保处理分母,以免被零除.

Also make sure you handle the denominator so you don't divide by zero.

这篇关于没有为所需参数提供值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆