Results 1 to 4 of 4
  1. #1
    undee69 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    39

    Post Calculating in Forms

    Good day everyone..

    Hoping to get some advice from you.

    What I am trying to track down is the number of leave days of our personnel as well as their remaining leave days but per record.

    I used the following record:
    TableEmp
    empID- 1
    empName - undee
    LeavePerYr - 21
    AccruedLeave - 2
    TotalLeave - 23

    LeaveHistory
    transactionID - autnumber
    empID - number


    AnnualLeave - number
    HalfdayLeave -number
    SickLeave - number
    SpecialHoliday - number
    UnpaidLeave - number
    RemainingLeave - number

    So for example, I have a total of 23 leave days. I applied leave for 2 days on one transaction.

    transactionID - 1
    empID - 1
    AnnualLeave - 2
    HalfdayLeave -0
    SickLeave - 0
    SpecialHoliday - 0
    UnpaidLeave - 0
    RemainingLeave - 21

    then on my next leave application, 3 days.

    transactionID - 2
    empID - 1
    AnnualLeave - 3
    HalfdayLeave -0
    SickLeave - 0
    SpecialHoliday - 0
    UnpaidLeave - 0
    RemainingLeave - 18

    on my thrid leave application, 1 day.

    transactionID - 2
    empID - 1
    AnnualLeave - 1
    HalfdayLeave -0
    SickLeave - 0
    SpecialHoliday - 0
    UnpaidLeave - 0
    RemainingLeave - 17

    I am able to count the total number of leaves as well as the remaining leaves already.

    My question now is, is there a way that the form can automatically subtract my "Totalleave" to my Annualleave and save it to "RemainingLeave" per record?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    That requires code and why would you want to? Saving calculated, especially aggregate, data is usually a bad idea. Calculate when needed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    In addition to June's comment, you do not have a normalized table. You are "committing spreadsheet".
    I know it seems simpler, but it is not. What happens if you need to add another type of leave?? As is, you will have to redesign your queries, forms and reports.


    You might think about a structure like this:

    LeaveHistory
    ------------
    transactionID_PK - autnumber
    empID_FK - number
    LeaveTID_FK Long
    LeaveDays - single


    LeaveTypes
    ----------
    LeaveID_PK - autonumber
    LeaveDesc - Text
    Last edited by ssanfu; 12-06-2012 at 03:18 PM. Reason: spelling

  4. #4
    undee69 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    39
    thanks for those inputs. I am still a beginner with access. will try them out ^_^

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

Similar Threads

  1. calculating
    By cade1980 in forum Access
    Replies: 3
    Last Post: 04-17-2012, 10:42 PM
  2. Calculating Age
    By Koyangie in forum Queries
    Replies: 2
    Last Post: 04-05-2012, 03:11 PM
  3. Calculating Age from DOB
    By coolpal9 in forum Forms
    Replies: 15
    Last Post: 01-12-2012, 05:26 AM
  4. Replies: 1
    Last Post: 01-04-2011, 05:04 AM
  5. Replies: 4
    Last Post: 04-01-2009, 08:49 PM

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