2

我有一个不断使整个数据库崩溃的查询。它运行良好(而且速度很快),我可以在 SQL 视图中打开它,但是当我单击设计视图时,我收到一条错误消息,上面写着“MS Access 已停止工作。Windows 正在检查解决方案”。

SQL 代码:

SELECT 

    dbo_job.job_date AS Job_Date, 
    dbo_job.item AS FG, 
    dbo_job.job AS Job, 
    dbo_job.suffix AS Suffix, 
    dbo_job.qty_complete AS SL_Production, 
    "" AS SAP_Production, 
    Nz(ibl.sumqty,0) AS SL_Inventory, 
    "" AS SAP_Inventory, 
    dbo_job.Uf_CustPo AS PO, 
    dbo_job.Uf_CustPOLine AS PO_Line

FROM 

    (dbo_job 
    LEFT JOIN 
                (SELECT

                          i2.item
                        , SUM(i2.qty_on_hand) AS sumqty
                        , i2.whse

                    FROM

                        dbo_item_by_location_lp_all AS i2

                    WHERE

                        i2.whse = [Forms]![MainForm]![Combo367]

                    GROUP BY

                          i2.item
                        , i2.whse

                )  AS ibl ON dbo_job.item = ibl.item) INNER JOIN dbo_job_sch ON (dbo_job.suffix = dbo_job_sch.suffix) AND (dbo_job.job = dbo_job_sch.job)

WHERE 

        dbo_job.job Like "H*"
    AND dbo_job.job_date= (Date() - (DatePart("w", Date(), 2, 1)-1))        
    AND dbo_job.item Not Like "indirect"
    AND dbo_job.whse = [Forms]![MainForm]![Combo367]

ORDER BY 

    dbo_job.Uf_Production_Line, 
    dbo_job_sch.priority;
4

1 回答 1

0

Access 中的每个查询都有元数据,用于记录列的宽度等内容。如果该元数据损坏,您可以看到您看到的行为。复制 SQL 文本,在 SQL 视图中进行新查询,然后将 SQL 文本粘贴到新查询中。然后尝试在设计视图中查看它。

于 2016-08-31T12:21:38.523 回答