Update query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phill86
    New Member
    • Mar 2008
    • 121

    #1

    Update query

    Hi,

    I have a select query that works out the difference between a start and an end time using datediff as follows

    SELECT T_ActiveSession .SessionID, T_ActiveSession .ProjID, T_ActiveSession .StartTime, T_ActiveSession .EndTime, T_ActiveSession .SessTypeID, DateDiff("n",[starttime],[endtime]) AS Expr1
    FROM T_ActiveSession
    GROUP BY T_ActiveSession .SessionID, T_ActiveSession .ProjID, T_ActiveSession .StartTime, T_ActiveSession .EndTime, T_ActiveSession .SessTypeID
    HAVING (((T_ActiveSess ion.ProjID)=[Forms]![F_ClientDetails]![SF_Session].[Form]![ProjID]) AND ((T_ActiveSessi on.SessTypeID)=[Forms]![F_ClientDetails]![SF_Session].[Form]![SessTypeID]));

    I then need to update a table with the following update query

    UPDATE T_AssignHours SET T_AssignHours.C ompletedHrs = Sum([Query1]![Expr1]);

    and i get the following message

    "you tried to execute a query that does not include the specified expression 'CompletedHrs' as part of the aggregate function"

    Any help is appreciated
  • emsik1001
    New Member
    • Dec 2007
    • 93

    #2
    Hi

    UPDATE T_AssignHours SET T_AssignHours.C ompletedHrs = Sum([Query1]![Expr1]);

    Do you want to update specific records or all records?

    Try subquery or DSUM

    p.s. Why do you want to put 'calculations' to the table?

    Regards
    Emil

    Comment

    Working...