Results 1 to 5 of 5
  1. #1
    halnurse is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2016
    Posts
    22

    Combine rows with like data

    I have a query that shows when material is on back order. The purpose of this query is to show how much material still needs to be received. Right now if part of the total amount of material needed is received the query shows the name of the material, total amount ordered, quantity received, and how much still needs to be received. For example, say that I ordered 10 fixture A's and 3 are received Wednesday. The query will show that 7 are on back order. If I then receive 4 on Friday, the query should show one line item with a total of 7 received and 3 on back order. However currently the query would show two separate line items, one with 3 received and 7 on back order and then a second line with 4 received and 6 on back order. Is there a way to combine these two lines? I already have "Group By" on the item description field. When I make the received quantity field "Sum" on the totals line an error occurs that says "You tried to execute a query that does not include the specified expression '[qryMaterial_Ordering].[tblMaterial_Tracking].[Quantity_Ordered]-[qryMaterial_Ordering].[Received]' as part of an aggregate function."



    Thanks for you time in advance

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    I think your problem is the expression:
    Code:
    [qryMaterial_Ordering].[tblMaterial_Tracking].[Quantity_Ordered]-[qryMaterial_Ordering].[Received]
    I believe the part in RED or that in BLUE should be deleted depending whether the field is in the table or query
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    You'd have an easier time with calculated form controls, methinks. One textbox for Required, one for DSum of all received (both can come from a query), one for Required - DSum of received.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    halnurse is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2016
    Posts
    22
    @Micron So have two columns for the quantity ordered field?

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    As many as you need. I forgot to mention that this might not be a suitable approach for your situation, but you didn't reveal much about what's behind the effort. If the number of groups will vary, then I don't see that working very well. You only stated there were 3 time slots. Make sure you address the suggestion in post 2 in case it is the solution. I'm afraid I didn't try hard to understand it as the language makes it a bit difficult to follow.

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

Similar Threads

  1. Replies: 1
    Last Post: 10-11-2016, 03:42 PM
  2. Combine tables, many rows to one box
    By djay1991 in forum Queries
    Replies: 9
    Last Post: 04-18-2016, 09:35 AM
  3. Query to combine some rows and leave others.
    By douglas.fagerstrom in forum Queries
    Replies: 13
    Last Post: 06-08-2015, 07:31 PM
  4. Combine Two Rows - SQL Query
    By Somnath_IT2006 in forum Queries
    Replies: 1
    Last Post: 12-23-2011, 06:30 AM
  5. combine rows
    By summerAIS in forum Queries
    Replies: 3
    Last Post: 07-31-2010, 10:13 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