Results 1 to 3 of 3
  1. #1
    lpkorn423 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    12

    Help with Error 3122

    I know that I have a problem because of the Sum function used to calculate the total in my query.

    This is the SQL I have for my query

    SELECT Invoices.InvoiceNumber, Invoices.InvoiceDate, [Job Lines].JobLine, [Job Lines].DeliveryDate, [Job Lines].PriceEach, Parts.PartNumber, Parts.PartDescription, Parts.PartWeight, Customers.BillingLine1, Customers.BillingLine2, Customers.BillingLine3, Customers.BillingLine4, Customers.BillingLine5, Customers.ShippingLine1, Customers.ShippingLine2, Customers.ShippingLine3, Customers.ShippingLine4, Customers.ShippingLine5, Jobs.PO, [Job Lines].[Quantity]*[Job Lines].[PriceEach] AS ExtendedPrice, Sum([ExtendedPrice]) AS Total, [Job Lines].LineLabel, Parts.catID, Invoices.Terms, Invoices.Rep, Invoices.[Ship Date], Invoices.Via, Invoices.FOB, Invoices.[Field Total], Invoices.[Field Material], Invoices.[Field Labor], Jobs.JobNumber, [Job Lines].[Back Ordered], [Job Lines].[Line Description], [Job Lines].Quantity, Invoices.[InvoiceTotal (Reference Only)], [Job Lines].[Quantity]*[Parts].[PartWeight] AS Weight
    FROM Invoices INNER JOIN (Customers INNER JOIN (Jobs INNER JOIN ((Parts INNER JOIN [Job Lines] ON Parts.PartNumber = [Job Lines].[fkPartNumber]) INNER JOIN [Invoice Lines] ON [Job Lines].JobLine = [Invoice Lines].[fkJobLine]) ON Jobs.JobNumber = [Job Lines].[fkJobNumber]) ON Customers.CustomerID = Jobs.[fkCustomerID]) ON Invoices.InvoiceNumber = [Invoice Lines].fkInvoiceNumber
    WHERE (((Invoices.InvoiceNumber)=[Enter Invoice Number]));

    My apologies for the format. I tried reading previous threads but I couldn't discern what clause needs to be added for the query to run.



    Thanks

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    You may get some assistance from the responses (by Pat Hartman) to a similar error 3122 at
    http://www.access-programmers.co.uk/...d.php?t=224065

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    You have an SQL aggregate function to create a field in query but this is not a GROUP BY (Totals) query.

    Consider building a report using Grouping & Sorting with aggregate calcs in group/report footers, instead of trying to calc aggregates in query.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  2. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  3. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  4. Replies: 1
    Last Post: 05-11-2012, 10:59 AM
  5. Replies: 5
    Last Post: 03-27-2012, 01:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums