2017-04-24 119 views
0

我有一個從包含計算字段的查詢派生的子窗體。它不會在窗體視圖中顯示。我已經設置了主和子字段鏈接,並且我的「允許添加」屬性設置爲是。我發現的原因之一是「表單基於沒有記錄的表格」。是這樣的。這當然是一對多的關係,子表格就是多邊表。子窗體不顯示在窗體視圖

下面是該查詢:

SELECT [Management Accounting table].Date_To_Budgets, 
     [Management Accounting table].Date_Returned_To_SCM, 
     [Management Accounting table].Date_To_Assets, 
     [Management Accounting table].Date_Returned_From_Assets, 
     [Management Accounting table].Select_Fund, 
     [Management Accounting table].Project, 
     [Management Accounting table].Select_SubProgramme, 
     [Management Accounting table].Cost_Centre, 
     [Management Accounting table].Item, 
     [Management Accounting table].Supplier, 
     [Management Accounting table].Amount, 
     Sum([Management Accounting table].Amount) AS [Total Amount], 
     SLD_Number 
     FROM [Management Accounting table] 
     GROUP BY [Management Accounting table].Date_To_Budgets, 
       [Management Accounting table].Date_Returned_To_SCM, 
       [Management Accounting table].Date_To_Assets, 
       [Management Accounting table].Date_Returned_From_Assets, 
       [Management Accounting table].Select_Fund, 
       [Management Accounting table].Project, 
       [Management Accounting table].Select_SubProgramme, 
       [Management Accounting table].Cost_Centre, 
       [Management Accounting table].Item, 
       [Management Accounting table].Supplier, 
       [Management Accounting table].Amount, 
       SLD_Number; 
+0

看看你自己的問題。你覺得很容易閱讀和理解?閱讀https://stackoverflow.com/help/how-to-ask和https://stackoverflow.com/help/mcve。 – jarlh

回答

1

GROUP BY查詢是由定義爲只讀。見例如here

因此,'Allow Additions'屬性設置爲yes無關緊要 - 您將無法根據此查詢將數據輸入到子表單中。

=>如果查詢顯示沒有記錄,您的子窗體將完全爲空。

+0

是否可以在不使用group by子句的情況下計算字段?我需要顯示一個總金額字段,現在我不知道如何處理這個問題。 –

+0

你可以使用'DSum()'表達式,那麼只有該列是隻讀的。但是你只能編輯單個記錄,所以我不明白每行的總和會有什麼用處? – Andre