none
Query Sum and Update RRS feed

  • Question

  • Dear Experts,

    Microsoft Access VBA:

     1st Query Named: Query1 are contain:-

    NumOfDays         TypeID

    2                          1

    3                          2

    2                          1

    3                          2

    4                          3

     

    Questions as below:- 1.) How to Sum the 'NumofDays' Groupby TypeID by Query? Wanted result is :-

    NumOfDays         TypeID

    4                           1

    6                           2

    4                           3

    2.) After that, how to update to Table1 by Query Method ?

    Both of the Query can be combine? SUM and Update together?

     Your prompt reply highly appreciated.

    Thanks.

    Danny

    Friday, July 22, 2011 10:34 AM

All replies

  • The query will look like:

    SELECT TypeID, SUM(NumOfDays) as SumNoD GROUP BY TypeID ORDER BY TypeID

    There may be a way to batch update in Access but I have never used it.   I recommend just iterating through the recordset and updating one at a time.

    Saturday, July 23, 2011 12:09 PM