Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2004
    Posts
    2

    Unanswered: How to compute 7 days per week ?

    I have this table.

    Table name: Employee
    Fields Type Description
    empID AutoIncrement
    Name Text Employee's Name

    Table name: Log
    Fields Type Description
    Name Text Employee's Name
    Time IN Date/Time Login Time
    Time OUT Date/Time Logout Time
    Date Date/Time Login Date

    Link/Relationship: Employee.Name = Log.Name

    Table Employee is use as MainForm
    Table Log is use as SubMainForm

    Here is a sample output of my form.

    EMPLOYEE'S ID: (AutoIncrement)
    NAME: Juan Dela Cruz

    DATE POST TIME IN TIME OUT REMARK
    11/01/04 NY 22:00 06:00 Regular
    11/02/04 NY 22:00 06:00 Regular
    11/03/04 PAL 22:00 06:00 Regular
    11/07/04 PAL 22:00 06:00 Regular
    11/08/04 NY 22:00 06:00 Regular
    11/09/04 PAL 22:00 06:00 Regular
    11/10/04 NY 22:00 06:00 Regular
    11/11/04 USA 22:00 06:00 Regular
    11/12/04 PAL 22:00 06:00 Regular
    11/13/04 USA 22:00 06:00 Regular
    11/14/04 PAL 22:00 06:00 Sunday

    Question: How will I come out with this kind of output if Date that falls on
    Sunday can only have a Remark value "Sunday" if the employee
    completed his duties from Monday to Saturday before his Sunday
    duty ?

    I tried this solution:

    Remark:IIF(Format([date]),"dddd")="Sunday","Sunday","Regular")

    But this kind of approach doesn't seem to be the one I wanted to do.

    See 11/14/04 above? the weekday is Sunday, and the Remark is "Sunday".

    Take A look on 11/07/04 which is also Sunday, but the Remark is "Regular" because the employee works from 11/01/04 to 11/03/04, that is 2 days before 11/07/04. Since the employee did not completed the entire week of his working period. His 11/07/04 will not be considered with a remark "Sunday".

    What should I do? I need solution in computing the 7 days of his work from Monday to Sunday. Before I can declare a remark "Sunday". This 7 days compution is continous 'coz every sunday, the total days should be 7 in Weekday([Date])= "Sunday". Otherwise, the Remark is "Regular"

    Thanks

    waltg72

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    Try

    IIf(Weekday("02/01/05") = 1, "Sunday", "Week Day")

    or

    IIf(Weekday("02/01/05", vbMonday) = 7, "Sunday", "Week Day")

    Depending on which day you start the week.

    Hope that helps.

    MTB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •