Question : How can I speed up this append query?

How can I speed up this append query?

I have this:

        strSQL = "INSERT INTO Appended_Prev_Wk_Item_Attr ( STR_NUM, YearNo, WeekNo, UPC_CD, NG_ITEM_NUM, REC_LOAD_DT, ITEM_SHLF_DPTH_QTY, ITEM_REORDER_POINT )"
        strSQL = strSQL & " IN '" & SaveToPath & "'"
        strSQL = strSQL & " SELECT Item_Attr.STR_NUM, Item_Attr.YearNo, Item_Attr.WeekNo, Item_Attr.UPC_CD, Item_Attr.NG_ITEM_NUM, Item_Attr.REC_LOAD_DT, Sum(Item_Attr.ITEM_SHLF_DPTH_QTY) AS SumOfITEM_SHLF_DPTH_QTY, Sum(Item_Attr.ITEM_REORDER_POINT) AS SumOfITEM_REORDER_POINT"
        strSQL = strSQL & " FROM Item_Attr"
        strSQL = strSQL & " WHERE (((Item_Attr.ITEM_REORDER_POINT) Is Not Null))"
        strSQL = strSQL & " GROUP BY Item_Attr.STR_NUM, Item_Attr.YearNo, Item_Attr.WeekNo, Item_Attr.UPC_CD, Item_Attr.NG_ITEM_NUM, Item_Attr.REC_LOAD_DT;"
        CurrentDb.QueryDefs("002_Append_to_Appended_Item_Attr_tbl").SQL = strSQL
        DoCmd.OpenQuery ("002_Append_to_Appended_Item_Attr_tbl")

Answer : How can I speed up this append query?

Try it and tell me if it works.

MIN(Result) will take the minimum of the results.

18,2000            1      Negative      27,0000            04/06/2010
21,0000            1      Positive       9,0000            04/06/2010
14,0000            1      Same            14,0000            04/06/2010

Sorted alphabetically, the Min of (Negative, Postive and Same) is "Negative".

16,5000            2      Same            16,5000            05/06/2010
31,0000            2      Positive      20,0000            05/06/2010
21,0000            2      Same            21,0000            05/06/2010

Sorted alphabetically, the Min of (Positive and Same) is "Positive".


It will work.
Random Solutions  
 
programming4us programming4us