Access 2007可更新查询

时间:2017-10-11 20:53:00

标签: sql ms-access

这个问题让我今天疯狂。

我使用的是Access 2007,由于某些原因,此查询无法更新。我使用链接表到SQL Server数据库,查询中的所有表都有主键。

如果我删除了tblCustTerms表并引用了它的表,我可以更新查询,所以我想问题就在那里。但是,我在CustID(可能在tblCustTerms中有多行)和DirectShipOrWarehouse =" Warehouse"上加入它。 (当与CustId结合使用时,将产生不超过一条记录)。如果这是问题(我稍微怀疑),我该怎么做才能解决它?

谢谢!

SELECT tblInventoryInvoices.ID, tblInventoryInvoices.SelectInvoice, 
  (tblInventoryInvoices.CTIPONUM & "." & tblInventoryInvoices.InvoiceSequence) AS CTIPONUM,
  tblInventoryInvoices.CustIDToInvoice AS CustID,
  tblInventoryInvoices.LocIDToInvoice AS LocID,
  tblOrders.DirectShiporWarehouse, tblInventoryInvoices.ERPExportDate AS InvoiceExportDate,
  tblInventoryInvoices.InvoiceSentDate, tblOrders.CustPO, tblItems.ItemDescription,
  tblCustTerms.qbTermsName, tblCustTerms.DirectShipOrWarehouse
FROM (tblInventoryInvoices INNER JOIN ((tblOrderDetail INNER JOIN tblItems ON 
  tblOrderDetail.ItemID = tblItems.ItemID) INNER JOIN tblOrders
  ON tblOrderDetail.CTIPONum = tblOrders.CTIPONum) ON tblInventoryInvoices.LineNumber = 
  tblOrderDetail.LineNumber) AND (tblInventoryInvoices.CTIPONUM =
  tblOrderDetail.CTIPONum)) INNER JOIN tblCustTerms ON
  tblInventoryInvoices.CustIDToInvoice = tblCustTerms.CustID
WHERE (((tblInventoryInvoices.ERPExportDate) Is Not Null)
   AND ((tblInventoryInvoices.InvoiceSentDate) Is Null) 
   AND ((tblOrders.CustPO)<>"ZPO") 
   AND ((tblCustTerms.DirectShipOrWarehouse)="Warehouse"))
ORDER BY (tblInventoryInvoices.CTIPONUM & "." & tblInventoryInvoices.InvoiceSequence), 
   tblInventoryInvoices.CustIDToInvoice, tblInventoryInvoices.LocIDToInvoice;

0 个答案:

没有答案