jhoover4
jhoover4

Reputation: 56

MS Access SQL Left Joins Not Working

Can't get this ms JET sql query (querying a 2007 Access database that I didn't write) to work. Error mentions "too few parameters, expects 4". I believe it has to do with my JOINs.

Anyone know what I'm missing?

SELECT TOP 500 [Load Items].[LoadItemsID] AS load_order_line_id,
        lo.[LoadOrderID] AS load_order_id,
        sp.[Description] AS product_description,
        sp.[Common Name] AS product_common_name,
        c.[Bill To Name] AS company_name,
        lp.[Ship Date] AS ship_date,
        al.[Ordered] AS order_quantity,
        al.[Price] AS sell_price,
        a.[Order Date] AS order_date,
        a.[Due Date] AS due_date
        FROM ((((((([Load Items]
            LEFT JOIN [Acknowledgement Lines] AS al
                ON al.[AcknowledgmentLineID] = [Load Items].[AcknowledgmentLineID])
            LEFT JOIN [Product] AS p
                ON p.[ProductID] = al.[ProductID])
            LEFT JOIN [Product Master] AS pm
                ON pm.[ProductMasterID] = p.[ProductMasterID])
            LEFT JOIN [Species] AS sp
                ON sp.[SpeciesID] = pm.[SpeciesID])
            LEFT JOIN [Acknowledgement] AS a
                ON a.[AcknowledgmentID] = al.[AcknowledgmentID])
            LEFT JOIN [Customer] AS c
                ON c.[CustomerID] = a.[CustomerID])
            LEFT JOIN [Load Orders] AS lo
                ON lo.[LoadOrderID] = [Load Items].[LoadOrderID])
            LEFT JOIN [Load Planner] AS lp
                ON lp.[LoadPlannerID] = lo.[LoadPlannerID]
        GROUP BY [Load Items].[LoadItemsID],
            lo.[LoadOrderID],
            sp.[Description],
            sp.[Common Name],
            c.[Bill To Name],
            lp.[Ship Date],
            al.[Ordered],
            al.[Price],
            a.[Order Date],
            a.[Due Date];

Upvotes: 0

Views: 38

Answers (1)

Laughing Vergil
Laughing Vergil

Reputation: 3756

The most likely cause is typos in field names. Each bracketed field name that doesn't correctly match the field name that you are trying to access in the tables is one missing parameter, as far as the parser is concerned.

Upvotes: 1

Related Questions