ใช้การกำหนด Zone โดยใช้ Dlookup ครับ
Copy SQL นี้ไปวางทับ แล้วรันดูครับ
ถ้าจะให้แสดง Rate โดย กำหนดให้ตรวจสอบ Zone และช่วงของ Weight ต้องเหมือนกันใส่แบบนี้ครับ
SELECT tbl_DLV.ID, tbl_DLV.Weight_Chg, tbl_Area.Zone, tbl_DLV.Total_Exception, tbl_DLV.VAS, tbl_Remote.Amount, Nz([Total_Exception])+Nz([VAS])+Nz([Amount]) AS Audit, IIf([Weight_Chg] Between 1 And 2,"1") & IIf([Weight_Chg] Between 3 And 4,"3") & IIf([Weight_Chg] Between 5 And 9,"5") & IIf([Weight_Chg] Between 10 And 14,"10") & IIf([Weight_Chg] Between 15 And 19,"15") & IIf([Weight_Chg]=20,"20") AS Weight_ChgRate, IIf([Zone]="BKK",DLookUp("BKK","tbl_Rate","Weight = " & Nz([Weight_ChgRate],0))) & IIf([Zone]="UPC1",DLookUp("UPC1","tbl_Rate","Weight = " & Nz([Weight_ChgRate],0))) & IIf([Zone]="UPC2",DLookUp("UPC2","tbl_Rate","Weight = " & Nz([Weight_ChgRate],0))) AS Rate
FROM tbl_Remote RIGHT JOIN (tbl_Area RIGHT JOIN tbl_DLV ON tbl_Area.Postal_Code = tbl_DLV.Postal_Code) ON tbl_Remote.Postal_Code = tbl_DLV.Postal_Code;