the specified field could refer to more than one table listed in the from clause of y

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krishnan0810
    New Member
    • Jul 2014
    • 1

    the specified field could refer to more than one table listed in the from clause of y

    Code:
    DB.Execute "INSERT INTO tblPO_Line_Items ( PO_ID, [Line Number], [Item Number], [Item Order Quantity], UoM, [Unit Price], [Total Line Amt], [Line Item Description], Oploc, [Account Code], Dept, [Sub Division], [Misc Ref], [Last Receipt Date1], [Quantity Received], [Total Amt Received], [Total Amt Paid], [Local Amt], [USD Amt],[OriginalCurrency],[Region], Load_Date )
     SELECT DISTINCT DOL_VOL_LOAD.PO_ID, DOL_VOL_LOAD.[Line Number], DOL_VOL_LOAD.[Item Number], DOL_VOL_LOAD.[Item Order Quantity], DOL_VOL_LOAD.UoM, DOL_VOL_LOAD.[Unit Price], DOL_VOL_LOAD.[Total Line Amt], DOL_VOL_LOAD.[Line Item Description], DOL_VOL_LOAD.Oploc, DOL_VOL_LOAD.Account_Code, DOL_VOL_LOAD.Dept, DOL_VOL_LOAD.[Sub Division], DOL_VOL_LOAD.[Misc Ref], DOL_VOL_LOAD.[Last Receipt Date1], DOL_VOL_LOAD.[Quantity Received], DOL_VOL_LOAD.[Total Amt Received], DOL_VOL_LOAD.[Total Amt Paid], DOL_VOL_LOAD.[Local Amt], DOL_VOL_LOAD.[USD Amt], DOL_VOL_LOAD.[Total Amt Currency Code: Name],DOL_VOL_LOAD.[Region],Date() AS Load_Date " & _
        "FROM (SELECT PO_ID, [Line Number], [Item Number], [Item Order Quantity], UoM, [Unit Price], [Total Line Amt], [Line Item Description], Oploc, tblLookup_Accounts.ID AS Account_Code, Dept, [Sub Division], [Misc Ref], [Last Receipt Date1], [Quantity Received], [Total Amt Received], [Total Amt Paid], [Local Amt], [USD Amt],[OriginalCurrency],[Region]  FROM (SELECT tblPO_Data.ID AS PO_ID, [Line Number], [Item Number], [Item Order Quantity], [Real UOM] AS UoM, [Unit Price], [Total Line Amt], [Item Description] AS [Line Item Description], Oploc, [Account Class] & [Sub Account] AS ACCOUNT_CODE_TEXT, Dept, [Sub Division], [Misc Ref2] AS [Misc Ref], [Last Receipt Date] AS [Last Receipt Date1], [Item Order Quantity] AS [Quantity Received], [Total Document Amount] AS [Total Amt Received], DOL_VOL_LOAD.[Total Amt Paid], [Local Amt], [USD Amt],DOL_VOL_LOAD.[Total Amt Currency Code: Name],[Region] " & _
        "FROM DOL_VOL_LOAD INNER JOIN tblPO_Data ON DOL_VOL_LOAD.[Document Number] = tblPO_Data.PO_Number)  
    AS DOL_VOL INNER JOIN tblLookup_Accounts ON DOL_VOL.ACCOUNT_CODE_TEXT = tblLookup_Accounts.Account_Code) 
     AS DOL_VOL_LOAD LEFT JOIN tblPO_Line_Items ON (DOL_VOL_LOAD.[Line Number] = tblPO_Line_Items.[Line Number])
     AND (DOL_VOL_LOAD.PO_ID = tblPO_Line_Items.PO_ID) WHERE tblPO_Line_Items.ID Is Null"
    Last edited by Rabbit; Jul 11 '14, 03:33 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code tags when posting code or formatted data.

    That error means you referenced a field that exists in more than one table and it doesn't know which one to use because you didn't tell it which table you want the field from.

    Comment

    Working...