I have an SQL in Access 2010 that was written by someone else that gives a Wrong Number of Arguments error when I try and run it. It's supposed to filter a report from a search page.
我在Access 2010中有一个SQL,它是由其他人编写的,当我尝试运行它时会出现错误的参数数量错误。它应该从搜索页面过滤报告。
SELECT Activity.[ProjNo], Activity.[Code], Activity.[Type], Activity.[ProjNoStatus],
Activity.[Preliminary], Activity.[Planner], Activity.[Designer],
Activity.[Officer], Activity.[Manager], Activity.[Staff], Activity.[Analyst],
Activity.[Manager], Activity.[DeptHead], Activity.[ContractNumber],
Activity.[InfoOfficer],Activity.[ProjNoDesigner]
FROM Activity
WHERE Activity.ProjNo=Index.ProjNo AND (((IIf([Forms]![SearchForm]![txtCode]="",
"*",[Activity].[Code]=[Forms]![SearchForm]![txtCode]))<>False)
AND ((IIf([Forms]![SearchForm]![txtType]="","*",[Activity].[ Type]="",
"*", [Activity].[Type]=[Forms]![SearchForm]![txtType]))<>False) AND
((IIf([Forms]![SearchForm]![txtProjNoStatus]="","*",
[Activity].[ProjNoStatus]<=[Forms]![SearchForm]![txtProjNoStatus]))<>False));
I'm not very experienced with SQL and, like I said, I didn't write this code (the person who did has long since retired) so any help would be great.
我对SQL不是很有经验,就像我说的那样,我没有编写这段代码(那个人早就退休了)所以任何帮助都会很棒。
1 个解决方案
#1
That query defines just one data source (table or query):
该查询只定义了一个数据源(表或查询):
FROM Activity
But then the WHERE
clause appears to reference another data source named Index:
但是WHERE子句似乎引用另一个名为Index的数据源:
WHERE Activity.ProjNo=Index.ProjNo
Since Index is not included in the FROM
clause, Access will object when you try to use it in the WHERE
clause.
由于Index不包含在FROM子句中,因此当您尝试在WHERE子句中使用它时,Access将对象。
However, I'm not sure that is the cause of the first error Access complains about. It may help to show us the full text of that error message.
但是,我不确定这是Access抱怨的第一个错误的原因。向我们展示该错误消息的全文可能会有所帮助。
#1
That query defines just one data source (table or query):
该查询只定义了一个数据源(表或查询):
FROM Activity
But then the WHERE
clause appears to reference another data source named Index:
但是WHERE子句似乎引用另一个名为Index的数据源:
WHERE Activity.ProjNo=Index.ProjNo
Since Index is not included in the FROM
clause, Access will object when you try to use it in the WHERE
clause.
由于Index不包含在FROM子句中,因此当您尝试在WHERE子句中使用它时,Access将对象。
However, I'm not sure that is the cause of the first error Access complains about. It may help to show us the full text of that error message.
但是,我不确定这是Access抱怨的第一个错误的原因。向我们展示该错误消息的全文可能会有所帮助。