S
Steve Warren
I have a form with a cmd button when pressed opens and runs an update query.
DoCmd.OpenQuery "qryProductPurchaseOrderPONumber", acNormal, acEdit
My question is: Could I do away with the update Query and copy the SQL
statement into code, so I have less querys? Is it a better way?
My SQL statement is:
UPDATE (tblMFG INNER JOIN tblProduct ON tblMFG.MfgID =
tblProduct.PrductMfgID) INNER JOIN (tblCustomerOrder INNER JOIN
tblProductOrderDetail ON tblCustomerOrder.OrderID =
tblProductOrderDetail.OrderID) ON tblProduct.ProductID =
tblProductOrderDetail.ProductID SET tblProductOrderDetail.PoNo =
[Forms]![frmProductPurchaseOrder]![PONumberID], tblProductOrderDetail.PoDate
= Date()
WHERE (((tblProductOrderDetail.PoNo) Is Null) AND
((tblMFG.SupplierID)=[Forms]![frmProductPurchaseOrder]![POSupplierID]) AND
((tblProductOrderDetail.ProductWantToOrder)=Yes) AND
((tblCustomerOrder.OrderApprovedOffice)=Yes) AND
((tblCustomerOrder.OrderApprovedSalesPerson)=Yes));
DoCmd.OpenQuery "qryProductPurchaseOrderPONumber", acNormal, acEdit
My question is: Could I do away with the update Query and copy the SQL
statement into code, so I have less querys? Is it a better way?
My SQL statement is:
UPDATE (tblMFG INNER JOIN tblProduct ON tblMFG.MfgID =
tblProduct.PrductMfgID) INNER JOIN (tblCustomerOrder INNER JOIN
tblProductOrderDetail ON tblCustomerOrder.OrderID =
tblProductOrderDetail.OrderID) ON tblProduct.ProductID =
tblProductOrderDetail.ProductID SET tblProductOrderDetail.PoNo =
[Forms]![frmProductPurchaseOrder]![PONumberID], tblProductOrderDetail.PoDate
= Date()
WHERE (((tblProductOrderDetail.PoNo) Is Null) AND
((tblMFG.SupplierID)=[Forms]![frmProductPurchaseOrder]![POSupplierID]) AND
((tblProductOrderDetail.ProductWantToOrder)=Yes) AND
((tblCustomerOrder.OrderApprovedOffice)=Yes) AND
((tblCustomerOrder.OrderApprovedSalesPerson)=Yes));