本文介绍了单击列标题以对数据表进行排序时出错(或单击以过滤)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况:Access 2007 Service Pack 2.  DataSheet视图中包含组合框的表单。  如果RowSource包含查询,则会出现此错误:  "查询中的语法错误。 不完整的查询条款"在两种情况下:  1)当我
点击列标题进行排序时,2)当我点击功能区中的过滤按钮时。

Situation: Access 2007 Service Pack 2.  A form in DataSheet view which contains a combobox.   If the RowSource contains a query, I get this error:  "Syntax error in Query.  Incomplete query clause" in two cases:  1) when I click the column header to sort and 2) when I click the Filter button in the Ribbon.

我可以点击A到Z,Z到A排序功能区中的按钮并排序而不会出现该错误。

我找到的解决方法是在RowSource属性中放置一个SQL语句。

SQL语句是:   ;

SELECT [tblEmployee]。[LastName]& IIf(Nz([tblEmployee]。[FirstName])="","",",")& [tblEmployee]。[FirstName] AS FullName,tblCompany.CompanyName,tblEmployee.EmployeeID

FROM tblCompany RIGHT JOIN tblEmployee ON tblCompany.CompanyID = tblEmployee.CompanyID

ORDER BY [tblEmployee ]。[LastName]& IIf(Nz([tblEmployee]。[FirstName])="","",",")& [tblEmployee]。[FirstName],tblCompany.CompanyName;
$


这对我来说就像是一个错误。 其他人遇到过这个吗?
I can click the A to Z, Z to A sort buttons in the Ribbon and sort without getting that error.
The workaround I found was to put an SQL statement in the RowSource property.
The SQL statement is:  
SELECT [tblEmployee].[LastName] & IIf(Nz([tblEmployee].[FirstName])="","",", ") & [tblEmployee].[FirstName] AS FullName, tblCompany.CompanyName, tblEmployee.EmployeeID
FROM tblCompany RIGHT JOIN tblEmployee ON tblCompany.CompanyID = tblEmployee.CompanyID
ORDER BY [tblEmployee].[LastName] & IIf(Nz([tblEmployee].[FirstName])="","",", ") & [tblEmployee].[FirstName], tblCompany.CompanyName;

This looks like a bug to me.  Anyone else encounter this?

推荐答案

你有没有包含一些在查询的SQL语句中有趣的格式化字符?将其粘贴到记事本中,删除所有CRLF,然后将其粘贴回来。单独运行。

Did you include some funny formatting characters in the SQL statement of the query? Paste it into Notepad, remove any CRLFs, and paste it back. Run it by itself.

< speculation>

<speculation>


这篇关于单击列标题以对数据表进行排序时出错(或单击以过滤)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 17:37