您试图执行不包含指定表达式的查询

You tried to execute a query that does not include the specified expression

抱歉,如果这个问题看起来很低级,但我从未被正式教授过 Access,我所知道的一切我都有些糊涂了。

基本上,我正在尝试进行交叉表查询,其中列和行 header 都是我实习的慈善航空公司飞往的机场的名称。

我试图让它的列和行都是机场名称,值是通过纬度和经度计算的两者之间的距离(都包含在与机场相同的 table名)。

我正在用这个小表达式计算距离 [Sqr((Lat2-Lat1)^2+(Long2-Long1)^2)] 但是当我把它输入时我收到错误消息:

You tried to execute a query that does not include the specified expression.

最终我的表情是这样的:

Sqr(([Airstrip List January 2017]![Latitude]-[Airstrip List January 2017]![Latitude])^2+([Airstrip List January 2017]![Longitude]-[Airstrip List January 2017]![Longitude])^2)

我认为我做错的是我告诉 Access 在 table 中查找纬度和经度,而我应该告诉它根据 header 和列是。

抱歉,如果这看起来很乱,但我对这类东西很陌生...感谢您的帮助。

您的交叉表查询需要设置如下:

  1. 将 table Airstrip List January 2017 添加到查询中两次,但它们之间没有任何连接。
  2. 给两个 table 别名(显示属性,然后当您单击 table 时,第一个 属性 是别名)。调用其中一个Start,另一个End
  3. Start table 中的机场名称作为网格中的第一列。将 Total 设置为 Group By,将 Crosstab 设置为 Row Heading
  4. End table 中的机场名称作为网格中的第二列。将 Total 设置为 Group By,将 Crosstab 设置为 Column Heading
  5. 将第三个网格列设置为Distance: Sqr(([Start].[Latitude]-[End].[Latitude])^2+([Start].[Longitude]-[End].[Longitude])^2)Total设置为SumCrosstab设置为Value

运行查询!