Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ms access Access 2010:该字段太小,无法接受您尝试添加的数据量,而没有显示_Ms Access_Ms Access 2010_Outer Join - Fatal编程技术网

Ms access Access 2010:该字段太小,无法接受您尝试添加的数据量,而没有显示

Ms access Access 2010:该字段太小,无法接受您尝试添加的数据量,而没有显示,ms-access,ms-access-2010,outer-join,Ms Access,Ms Access 2010,Outer Join,我知道关于这个访问错误消息有几个问题,但它们并不相关,因为我的查询没有使用不同的关键字 我有两个类似的查询,一个包含贷方,另一个包含借方。它们按月份和类别分组 最终,我希望在这两个表上有一个完整的外部联接,这样我就可以减去它们,得到每个类别中每个月的结果余额 然而,Access不允许完全外部联接,所以我需要在Null处进行右外部并集左外部并集 我现在正在尝试对月份和类别ID字段进行正确的外部联接。当我在一个字段上执行外部联接时,它会按预期工作。当我在另一个字段上执行此操作时,它会按预期工作,但当

我知道关于这个访问错误消息有几个问题,但它们并不相关,因为我的查询没有使用不同的关键字

我有两个类似的查询,一个包含贷方,另一个包含借方。它们按月份和类别分组

最终,我希望在这两个表上有一个完整的外部联接,这样我就可以减去它们,得到每个类别中每个月的结果余额

然而,Access不允许完全外部联接,所以我需要在Null处进行右外部并集左外部并集

我现在正在尝试对月份和类别ID字段进行正确的外部联接。当我在一个字段上执行外部联接时,它会按预期工作。当我在另一个字段上执行此操作时,它会按预期工作,但当我在两个字段上加入时,我得到的字段太小,无法接受您尝试添加的数据量

表1:

制作人:

SELECT [transactions by category].[categoryid]                    AS CategoryID,
       Format([account transactions].[transaction date], "mm/yy") AS MonthYear,
       Nz(SUM([transactions by category].[amount]), 0)            AS
       [Category Total]
FROM   [transactions by category]
       INNER JOIN [account transactions]
               ON [account transactions].[id] =
                  [transactions by category].[transactionid]
WHERE  [account transactions].[transaction type] <> 8
GROUP  BY Format([account transactions].[transaction date], "mm/yy"),
          [transactions by category].[categoryid]; 
SELECT [transactions by category].[categoryid],
       Format([account transactions].[transaction date], "mm/yy") AS MonthYear,
       Nz(SUM([transactions by category].[amount]), 0)            AS
       [Category Total]
FROM   [transactions by category]
       INNER JOIN [account transactions]
               ON [account transactions].[id] =
                  [transactions by category].[transactionid]
WHERE  [account transactions].[transaction type] = 8
GROUP  BY Format([account transactions].[transaction date], "mm/yy"),
          [transactions by category].[categoryid]; 
给出错误的正确联接:

SELECT * FROM
  ((SELECT [transactions by category].[categoryid],
           Format([account transactions].[transaction date], "mm/yy") 
              AS MonthYear,
           Nz(SUM([transactions by category].[amount]), 0) AS [Category Total]
    FROM   [transactions by category]
           INNER JOIN [account transactions]
                   ON [account transactions].[id] =
                      [transactions by category].[transactionid]
    WHERE  [account transactions].[transaction type] = 8
    GROUP  BY Format([account transactions].[transaction date], "mm/yy"),
              [transactions by category].[categoryid]) AS [Category Returns]
RIGHT JOIN 
   (SELECT [transactions by category].[categoryid] AS CategoryID,
           Format([account transactions].[transaction date], "mm/yy") 
               AS MonthYear,
           Nz(SUM([transactions by category].[amount]), 0) AS [Category Total]
    FROM   [transactions by category]
           INNER JOIN [account transactions]
                   ON [account transactions].[id] = 
                      [transactions by category].[transactionid]
    WHERE  [account transactions].[transaction type] <> 8
    GROUP  BY Format([account transactions].[transaction date], "mm/yy"),
              [transactions by category].[categoryid]) AS [Category Debits]

ON [Category Returns].[categoryid] = [Category Debits].[categoryid]
   AND [Category Returns].[monthyear] = [Category Debits].[monthyear] ); 

这个错误似乎发生在文本字段中。当我使用Format时,MonthYear字段会变成文本字段吗?即使如此,它也只有5个字符长。另外,当我只在MonthYear列上进行连接时,连接会起作用,但仅当我在这两个字段上进行连接时,连接才会失败。

根据您的标记,您正在使用SQL server作为后端。您遇到的问题不是来自MS Access,而是来自MS Access和SQL Server的组合。查询将在纯MS Access环境中工作。是的,格式不会转换为文本

可以用来创建使用SQLServer语法运行的查询,因此可以使用完整的外部连接,或者您可以考虑

编辑并重新更改标记


如果其中一个字段是备注字段,请参阅。在这样复杂的查询中,最好将备注字段减少到255个或更少。

+1如果所有这些表都位于SQL Server上,那么如果您可以使用Remou的第二个选项,我将使用Remou。它还应该比链接的SQL Server表上的Access查询提供更好的性能。@Mattdonan只有一个选项,该查询在混合环境中无法工作。这不是SQL Server。我不知道我是怎么说的,但这是一个严格意义上的MS Access 2007数据库。我仍在查看该链接,看看这是否是一个好的解决方案。@user1068058您的标签上写着SQL Server。我在MS Access ie中用Jet/ACE测试了一个非常类似的查询,它对我很有效。这个标记为2007,但标题是2010。是哪一个?