Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Vegaanders is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2016
    Location
    Cyprus
    Posts
    29

    Total in a report

    I have created a small access project to store employees and their salaries and to print out payslips. With the help from this forum, I have solved all problems except one. In the payslip I want to show the total salary paid to the employee during the year. Can this be done?



    Regards

    Anders

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    put the [amtPd] field in the footer of the EMP#
    in the source of this field set to : =sum([amtPd])

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Or use DSum(), if the full year's data is not included in the source of the report, which I'm guessing it's not.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Vegaanders is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2016
    Location
    Cyprus
    Posts
    29
    I did and it only shows the current month's salary

    Can it be because the query only picks up salary for one month?

    Anders

  5. #5
    Vegaanders is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2016
    Location
    Cyprus
    Posts
    29
    Can you tell a beginner how to write this? The table is Payments and the field is Salary_Euro

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    This should get you started:

    DLookup Usage Samples

    Using DSum() instead of DLookup().
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Vegaanders is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2016
    Location
    Cyprus
    Posts
    29
    OK works in a way. The problem is that it shows the total salary for all employees not only the one the payslip is for. The query pick out all employees that have had salary for the month I ask for

    Anders

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Did you add the criteria as shown in the link?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Vegaanders is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2016
    Location
    Cyprus
    Posts
    29
    No that part I could not figure out. I understand it the criteria that will solve it but have no clue how.

    Anders

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Well, I can only guess at field names and data types. Something like:

    =DLookup("Salary_Euro", "Payments", "EmployeeID = " & EmployeeID)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    Vegaanders is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2016
    Location
    Cyprus
    Posts
    29
    Well I changed and now I get the same answer again, only the salary for the month the payslip is for. You were almost right, it is Employment_ID

    Anders

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Sorry, cut/paste goof. Try

    =DSum("Salary_Euro", "Payments", "Employment_ID = " & Employment_ID)

    It occurs you may also need a criteria for this year.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    Vegaanders is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2016
    Location
    Cyprus
    Posts
    29
    OK now it works if I enter the Employment ID when it asks for it. But with 50+ employees that is not possible. I would like to create all the payslips by answer the question What month

    Anders

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    It shouldn't prompt you. Try switching to the full form/report syntax from the link.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    Vegaanders is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2016
    Location
    Cyprus
    Posts
    29
    Hi!
    I realized that the Employment_ID was not in the Query. Now it works. Thanks for all help!

    Anders

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

Similar Threads

  1. Sum Total In a SubGroup on Report
    By Bucky16 in forum Reports
    Replies: 1
    Last Post: 12-23-2015, 03:07 PM
  2. Replies: 3
    Last Post: 01-18-2015, 06:05 PM
  3. Replies: 4
    Last Post: 10-12-2012, 03:42 PM
  4. Total in a report
    By jenncivello in forum Reports
    Replies: 2
    Last Post: 07-19-2012, 12:49 PM
  5. Replies: 1
    Last Post: 06-29-2010, 03: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