简体   繁体   English

Access 2010为什么提示我输入参数值

[英]Access 2010 why am I being prompted to enter parameter value

Here is my sub-query from Access 2010. I'm prompting user to input year (yyyy) and Month (1-12) but for some reason user is also getting prompted for Site. 这是我在Access 2010中进行的子查询。我在提示用户输入年份(yyyy)和月份(1-12),但由于某些原因,还会提示用户输入Site。 Can someone tell me why? 有人可以告诉我为什么吗? I do not want user prompted for Site. 我不希望用户提示输入网站。

PARAMETERS [Enter Year (yyyy)] Text ( 255 ), [Enter Month (1-12)] Short;
SELECT Sum([AB Units]) AS [Monthly AB Units], 
SELECT Count(*) FROM [New  Referrals] 
   WHERE ((Year([New Referrals].[Date of Referral]) = [Enter Year (yyyy)]) 
   AND (Month([New Referrals].[Date of Referral]) = [Enter Month (1-12)]))
   AND ([New Referrals].[First Visit] Is Null) 
   AND (([New Referrals].Site)="2")) 
 AS Waitlist FROM [DNS] 
WHERE (((Year([DNS].[Date of Entry]))=[Enter Year (yyyy)]) 
   AND ((Month([DNS].[Date of Entry]))=[Enter Month (1-12)]) 
   AND (([DNS].Site)="2")); 

Joe

It is most likely that the field called Site is not in either [New Referrals] or [DNS]. 最有可能是名为“站点”的字段不在[新引荐来源]或[DNS]中。 Check both tables and make sure that field exists in them, since there is a reference to that field in your query. 检查两个表并确保其中都存在该字段,因为查询中有对该字段的引用。

For further review, take a look at this article on the Microsoft website . 要进一步查看,请访问Microsoft网站上的这篇文章

Like @JohnnyBones suggests it's most likely a misnamed field, but saying that you do have a syntax error that should show up in your SQL View: 就像@JohnnyBones一样,它很可能是一个错误命名的字段,但是说您确实有一个语法错误,应该在您的SQL视图中显示:

You're missing a bracket that goes with the first WHERE clause 您缺少第一个WHERE子句附带的括号

This 这个

WHERE ((Year([New Referrals].[Date of Referral])

should be this: 应该是这样的:

WHERE (((Year([New Referrals].[Date of Referral])

A good text editor (I use Textpad) will show you matching brackets - and more importantly which ones don't have a match 一个好的文本编辑器(我使用Textpad)将为您显示匹配的括号-更重要的是,哪些不匹配

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM