Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185

    Append Query

    I have a query (BoM_ItemAnalysis_RunTot) with a calculation in it which does a running total on demand for material. I also have a calculation which subtracts the running total from the On Hand inventory to identify which builds I may run out of parts on.
    I need to create a temp table to due further analysis and generate reports from.
    The query runs in less than 1 second.

    I created an append query, using (BoM_ItemAnalysis_RunTot) as the source to append the results to a temporary table. I first did a make table and only ran it against 1 record to create the table. I then removed the criteria to append all records and all it will do now is run.

    My SQL is below for the append. Thoughts on how I can make this work?


    INSERT INTO BoM_ItemAnalysis_RunTot_T ( ID, Component, BuildPriority, RECOV_DATE, PO_RTS, Comp_Descript, Comp_Type, Comp_Stat, TotalQty, RunningTotal, OH, Balance, [S&OP_CATEGORY], PART, CAT_Part, PO_RTS_DATE, STATUS, PRODUCT_DESCRIPTION, PRODUCT_NAME )
    SELECT BoM_ItemAnalysis_RunTot.ID, BoM_ItemAnalysis_RunTot.Component, BoM_ItemAnalysis_RunTot.BuildPriority, BoM_ItemAnalysis_RunTot.RECOV_DATE, BoM_ItemAnalysis_RunTot.PO_RTS, BoM_ItemAnalysis_RunTot.Comp_Descript, BoM_ItemAnalysis_RunTot.Comp_Type, BoM_ItemAnalysis_RunTot.Comp_Stat, BoM_ItemAnalysis_RunTot.TotalQty, BoM_ItemAnalysis_RunTot.RunningTotal, BoM_ItemAnalysis_RunTot.OH, BoM_ItemAnalysis_RunTot.Balance, BoM_ItemAnalysis_RunTot.[S&OP_CATEGORY], BoM_ItemAnalysis_RunTot.PART, BoM_ItemAnalysis_RunTot.CAT_Part, BoM_ItemAnalysis_RunTot.PO_RTS_DATE, BoM_ItemAnalysis_RunTot.STATUS, BoM_ItemAnalysis_RunTot.PRODUCT_DESCRIPTION, BoM_ItemAnalysis_RunTot.PRODUCT_NAME
    FROM BoM_ItemAnalysis_RunTot


    WHERE (((BoM_ItemAnalysis_RunTot.RECOV_DATE)<Now()+90));

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Instead of APPEND, try a MAKE TABLE for all data.

    Use VBA to delete table and run MAKE TABLE.
    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.

  3. #3
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    Thank you for the response! I am unfortunately having the same results. The query to make the table just runs and seems to get hung up. After 10 minutes, the status bar shows the query as being "JUST ABOUT DONE" and then it just stalls out.

  4. #4
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    I even reduced the data to the 5 key columns I need the snap shot of, and am receiving the exact same performance. I am at a loss. There are approx 147,000 records from the results of the query, but I have never had this type of performance error before, in this scenario.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You have done APPEND with running sum query successfully with other data?

    Access doesn't handle this sort of calculation in queries nicely. Poor performance is not uncommon with Cartesian product SQL or domain aggregate function. SQLServer and other RDBMS platforms have functionality for this. I've never needed running total 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.

  6. #6
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    I have not used the results to append to a table before.
    Somehow I need to though, as you eluded to, Access struggles with this type of equation.
    I can not do any analysis work to the data results due to this, and was hoping appending to the temp table, I'd be able to build queries to perform the analysis to the data.
    Any new query to analyze the results of the running totals query does not work.

    This is a real struggle!

    Any thoughts on how to evaluate the running total as an absolute value vs a calculated result? If I try and query against the results, Access does not handle this well at all. Results are inconsistent and not able to process it.
    Last edited by jlgray0127; 05-01-2023 at 11:43 AM.

  7. #7
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    So, I did some digging on another database I have with a running total calculation in it.
    I used DSum in this query, but only on one criteria. I created a make table and then updated to append query and the query worked just fine with using DSum!

    I'm not the greatest with DSum and am struggling to recreate the statement in my new query with two criteria.


    RunningTotal2: DSum("[TotalQty] ","[BoM_ITemAnalysis_T]","[ID]<= " & [ID] & " And [Component] <= " & [Component])
    The results are #ERROR

    Can someone please help me with this formula? I'm sure I'm missing something simple!

    Thank you so much, in advance!!!!

  8. #8
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Can you get that to not produce the error with only 1 criteria? The criteria values are actual number data type and not text?
    Wondering if the space at the end here might be an issue - "[TotalQty] "
    Also, how is this helpful - "[ID]<= " & [ID] & " And [Component] <= " & [Component]) ? If you substitute values the written version would be like

    5<= 5 And 8 <= 8)
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Is Component a number or text field? Text field parameter needs apostrophe delimiters.

    Should Component use = instead of <=?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  10. #10
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185

  11. #11
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    Thank you!
    Yes, it is a text box! Can you please help me? I'm not sure if I'm just brain fried or what my deal is. I can not seem to get the expression right on the text box.
    Can you please help? I do not fully understand how all the quotes work in a statement like this, and am struggling to find a reference that 1, explains what the equation is doing, and two, a sample of a multiple criteria with text box.

    I do think I can change it to Component = Component. I believe with my first statement below, there may have been a problem with restarting the running total on the first record where the component changed, though, which is why I went to the <=. I'll switch back to <= if it repeats.

    Thank you, again!!!

  12. #12
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    I got it!
    It still is not pasting to the table like I did in the sample database I had, but I figured out the expression... my goodness!
    You know the saying, "I could not see the forrest, for all the trees." ?

    I think I'd been looking at this too long and trying to many different things. Sorry about that!

    It did not fix my problem as I'd hoped, sadly.

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Text box is not same thing as text field.

    I asked if Component is a text field - data type in table.
    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.

  14. #14
    jlgray0127 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    185
    Yes, it is a text field. Apologies, that is what I was attempting to state.

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    So did you fix with apostrophe delimiters:

    "[ID]<= " & [ID] & " And [Component] = '" & [Component]) & "'"
    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.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 02-03-2021, 08:32 AM
  2. Replies: 19
    Last Post: 10-03-2017, 09:10 AM
  3. Access can't append all the records in the append query
    By fluffyvampirekitten in forum Access
    Replies: 2
    Last Post: 08-27-2015, 01:53 AM
  4. Replies: 1
    Last Post: 10-06-2011, 08:37 AM
  5. Replies: 7
    Last Post: 07-21-2011, 01:01 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