Results 1 to 15 of 15
  1. #1
    Chekotah is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Mar 2014
    Posts
    32

    Wink summing multiles fields from one table in a form.

    [AR&R Hours]+[PTO # of Hours]+[Meeting/Calls # of Hours]+[System Issues # of Hours]+[BAU Training # of Hours]+[Exception Processing Hours]+[AIG Related Activities]+[Admin Work Hours]+[Migration Hours]+[Project Hours]



    Need the fastest and easiest way to auto calculate the above in a field on a form. i can get it to calculate in a query but need it to do in the form as well.

    Please advise. I know that this may seem like a simple request. but everything I have tried has failed.

    Thanks Chekotah.

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Put the calculated field in a query, and then base the form on that query instead of the table. The calculated field should update as changes are made to the other fields. Watch out for nulls, though - they can cause problems with a calculated field (check out the Nz function if this might be a problem)

    HTH

    John

  3. #3
    Chekotah is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Mar 2014
    Posts
    32
    Thank you. When creating the form from the query. It would not allow me to make any entries on the form. Am I missing something.

  4. #4
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Assuming you created and saved the query - are you able to open and update the query data in MS Access query design, i.e. outside the form? (Be careful when you try that!!). If you can update and add, then there is probably something wrong in the form.

    If you can't add/update using just the query - does the query have more than one table?

  5. #5
    Chekotah is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Mar 2014
    Posts
    32
    Hi John. Can not create in the query either. There is only one table.

  6. #6
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Strange - you should be able to. Can you post the SQL for the query (use SQL view in query design)? It's not a summation query is it? Those are not updatable.

  7. #7
    Chekotah is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Mar 2014
    Posts
    32
    SELECT [Earned Hours].Date, [Earned Hours].Name, [Earned Hours].[Employee ID], [Earned Hours].Department, [Earned Hours].Process, [Earned Hours].LOB, [Earned Hours].[Regular Hours], [Earned Hours].[Overtime Hours], [Earned Hours].[Core Production # of Hours], [Earned Hours].Volume, [Earned Hours].[AR&R Description], [Earned Hours].[AR&R Hours], [Earned Hours].[PTO # of Hours], [Earned Hours].[Meeting/Calls # of Hours], [Earned Hours].[System Issues # of Hours], [Earned Hours].[BAU Training # of Hours], [Earned Hours].[Exception Processing Hours], [Earned Hours].[AIG Related Activities], [Earned Hours].[Admin Work Hours], [Earned Hours].[Migration Hours], [Earned Hours].[Migration PID], [Earned Hours].[Project Hours], Sum(([AR&R Hours]+[PTO # of Hours]+[Meeting/Calls # of Hours]+[System Issues # of Hours]+[BAU Training # of Hours]+[Exception Processing Hours]+[AIG Related Activities]+[Admin Work Hours]+[Migration Hours]+[Project Hours])) AS [Total Exception Time], [Earned Hours].[Total Hours], [Earned Hours].[Comments/Explainations], [Earned Hours].[Earned hours]
    FROM [Earned Hours]
    GROUP BY [Earned Hours].Date, [Earned Hours].Name, [Earned Hours].[Employee ID], [Earned Hours].Department, [Earned Hours].Process, [Earned Hours].LOB, [Earned Hours].[Regular Hours], [Earned Hours].[Overtime Hours], [Earned Hours].[Core Production # of Hours], [Earned Hours].Volume, [Earned Hours].[AR&R Description], [Earned Hours].[AR&R Hours], [Earned Hours].[PTO # of Hours], [Earned Hours].[Meeting/Calls # of Hours], [Earned Hours].[System Issues # of Hours], [Earned Hours].[BAU Training # of Hours], [Earned Hours].[Exception Processing Hours], [Earned Hours].[AIG Related Activities], [Earned Hours].[Admin Work Hours], [Earned Hours].[Migration Hours], [Earned Hours].[Migration PID], [Earned Hours].[Project Hours], [Earned Hours].[Total Hours], [Earned Hours].[Comments/Explainations], [Earned Hours].[Earned hours];

  8. #8
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Your problem is the GROUP BY, which makes it a summation query. A summation query is not updatable.

    Is there a reason why you are using GROUP BY?

  9. #9
    Chekotah is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Mar 2014
    Posts
    32
    Hi -

    No reason in particular. It defaulted to it when I created the query.. Please advise what it should be. I do appreciate all the help. This project has been somewhat more complexed than I had orginally hoped. which I am sure all projects turn out that way.

  10. #10
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    The query defaulted to GROUP BY because you clicked the summation button in query design. What it does is this case is combine all records where EVERY FIELD has the same value, into one record in the query. I doubt you need it; open the query in design mode, and turn the summation off (the query design row labeled "Totals" will go away). Save and run the query - it should now be updatable.

    John

  11. #11
    Chekotah is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Mar 2014
    Posts
    32
    ok. I have removed the total field however now my calculation for the total exception time doesnt work. I need it to calculate all the below fields.

    Total Exception Time: Sum([AR&R Hours]+[PTO # of Hours]+[Meeting/Calls # of Hours]+[System Issues # of Hours]+[BAU Training # of Hours]+[Exception Processing Hours]+[AIG Related Activities]+[Admin Work Hours]+[Migration Hours]+[Project Hours])

  12. #12
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Sorry, I missed that in your original SQL. The SUM function as you have it above does not work that way. If you want to get the sum of the contents of several different fields in a query, just add them:


    Total Exception Time: [AR&R Hours]+[PTO # of Hours]+[Meeting/Calls # of Hours]+[System Issues # of Hours]+[BAU Training # of Hours]+[Exception Processing Hours]+[AIG Related Activities]+[Admin Work Hours]+[Migration Hours]+[Project Hours]

    Note that if any of the fields you are adding together are Null, the whole total will be Null (and therefore incorrect). If this can happen, use the Nz function to set Null values to 0, for example: Nz([Exception Processing Hours], 0)

    It wouldn't hurt to do that for all the fields you are adding, just in case. Each field would be in a separate Nz() function.

    HTH

    John

  13. #13
    Chekotah is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Mar 2014
    Posts
    32
    thank you, thank you , thank you so much. It worked.

  14. #14
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Glad you got it working. Gook luck in your project.

    John

  15. #15
    Chekotah is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Mar 2014
    Posts
    32
    Thank you on the luck part. I am needing it. this project opens up many questions and opportunities. I still have some things to work out on it such as user interface and tons of reports to be generated out of it.

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

Similar Threads

  1. Summing specific fields on a report
    By spacekowboy in forum Access
    Replies: 4
    Last Post: 02-18-2014, 08:44 AM
  2. Summing DateDiff Fields
    By 1Christmas2 in forum Queries
    Replies: 3
    Last Post: 09-29-2013, 01:57 PM
  3. Summing Fields between tables
    By marrone12 in forum Queries
    Replies: 9
    Last Post: 09-16-2011, 12:37 PM
  4. Summing Calculated Fields
    By Zoran in forum Queries
    Replies: 1
    Last Post: 03-31-2010, 01:59 PM
  5. Replies: 0
    Last Post: 01-24-2009, 11:40 AM

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