0

我遇到了这个How Do I Sequentially Number Records in an Access Query 以便根据我发布的这个stackoverflow 问题(我从来没有做我想要做的事情)做我想做的事情,但每次我尝试将 AS Counter 添加到我得到的查询中

The expression you entered contains invalid syntax
You may have entered an operand without an operator

使用以下 sql:

SELECT Maintable.NumBR, Maintable.*, [Ehow] AS Expr1
FROM Maintable
WHERE (((Maintable.[NumBR])="" 
  Or (Maintable.[NumBR]) Like "3101" 
  Or (Maintable.[NumBR]) Like "3541" 
  Or (Maintable.[NumBR]) Like "4381" 
  Or (Maintable.[NumBR]) Like "AS3281" 
  Or (Maintable.[NumBR]) Like "4260" 
  Or (Maintable.[NumBR]) Like "4315" 
  Or (Maintable.[NumBR]) Like "4330" 
  Or (Maintable.[NumBR]) Like "4382" 
  Or (Maintable.[NumBR]) Like "9410" 
  Or (Maintable.[NumBR]) Like "9570" 
  Or (Maintable.[NumBR]) Like "AS3710" 
  Or (Maintable.[NumBR]) Like "AS4450" 
  Or (Maintable.[NumBR]) Like "K400" 
  Or (Maintable.[NumBR]) Like "3100" 
  Or (Maintable.[NumBR]) Like "3130" 
  Or (Maintable.[NumBR]) Like "3280" 
  Or (Maintable.[NumBR]) Like "3495" 
  Or (Maintable.[NumBR]) Like "3540" 
  Or (Maintable.[NumBR]) Like "3610" 
  Or (Maintable.[NumBR]) Like "3700" 
  Or (Maintable.[NumBR]) Like "4110" 
  Or (Maintable.[NumBR]) Like "4200")

AND (([Ehow])=DCount("[NumBR]","[Maintable]"," [NumBR] <= " & [NumBR])));

编辑上一个 stackoverflow 问题中提出的问题回答了这个问题。

4

1 回答 1

1

您的查询中不需要AS Counter短语。在链接的示例中,它被添加到SELECT语句中以别名列;在您的示例中,您正在使用WHERE子句,因此AS短语不会做任何事情(实际上是无效的)。

于 2012-08-13T19:53:33.290 回答