Results 1 to 6 of 6
  1. #1
    Davidyam is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    14

    Simple Sum qn

    Hi,

    I am trying to create a database to clock overtime for my officers and I am new using ms access.

    May I know how do I add up hours on a column base on the same name on another column on the same table and present it on another table.
    e.g

    Table: Overtime


    Officer Overtime clock
    David 5
    Daniel 4
    David 3

    Table: Account overview
    Officer Total overtime clock
    David 8

    Thank you very much

    Best regards,
    David Yam

  2. #2
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Hi David

    For what you appear want you don't actually want to store the data in a second table.

    What you want is a query, something along the lines of:

    SELECT DISTINCT [OFFICER], SUM([Overtime clock]) AS [Total Overtime clock] FROM [Overtime]

    (I wrote it in SQL as its the easiest way to write these things, you can use the access query builder but I find it almost impossible to describe the process to do that)

    It may be slightly different depending on any other fields you might have (i.e. you might want a WHERE clause on for example an OT_date field)

    Just for information, as a rule of thumb:
    Tables are for storing data
    Queries take the stored data and manipulate it
    Forms allow users to modify and view data without having full access to your tables and queries (designed for use solely on screens)
    Reports allow you to get the useful data out (Designed for output to a printer)

    Hopefully that should get you the results you are after.

  3. #3
    Davidyam is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    14
    Hi R_Badger,

    Thanks for the information. Actually I need it in another table because I need to store the data in sharepoint and I can't upload query into it. Is it possible to convert the SQL that you provided and convert to a VBA code, maybe I can try to work on that and pull the data and store onto the table.

    Thank You very very much.

    Best Regards,
    David Yam

  4. #4
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Are you hosting the tables directly on sharepoint or exporting a table to upload?

    My experience with sharepoint is limited (Although I use it the connection to our server is poor at best so I try to steer clear of it)

  5. #5
    Davidyam is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    14
    Hi R_Badger,

    I am actually hosting the tables directly in sharepoint, and creating the link from access. My officers hope to see the raw data in sharepoint itself thus i need to create another table where by it shows the sum of the overtime clocked. I am currently using a crosstab query to update the Total OT clocked base on the status depending on how the approving officer updates it, e.g Approved, OT-pending, Rejected. However I don't know how to update my query to the table itself so that i can store it in sharepoint for my officers to see. Do you have a solution or other suggestion on what should I do..

    Thank You Very much for your help.

    Best Regards,
    David Yam

  6. #6
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    Well the best suggestion I can make to that is having an extra table and running an append query to it, the thing is that unless you either run a delete query each time to remove the data each time, or have some other method of differentiating the data, then it will quickly become ambiguous i.e one weeks data will not be easily differentiated from another, however using your example as a basis:

    Tbl_Total_OT

    Officer Total_OT_HRs

    Then create a and append query

    INSERT INTO Tbl_Total_OT (Officer, TOTAL_OT_HRS) SELECT [Officer], SUM([OVERTIME CLOCK]) as [Total_OT_HRS] FROM [Overtime]

    You would likely want more fields, however this should point you in the right direction

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

Similar Threads

  1. Sure It is very simple Yes/No
    By easedaway in forum Access
    Replies: 5
    Last Post: 02-02-2012, 11:40 AM
  2. Help with simple vba
    By mejia.j88 in forum Programming
    Replies: 21
    Last Post: 11-30-2011, 08:42 AM
  3. Need some help with simple VBA Thanks
    By everette in forum Programming
    Replies: 1
    Last Post: 08-07-2011, 08:32 AM
  4. Replies: 0
    Last Post: 10-21-2010, 08:24 AM
  5. Simple Export Not So Simple
    By jgelpi16 in forum Programming
    Replies: 11
    Last Post: 09-01-2010, 07:23 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