Results 1 to 4 of 4
  1. #1
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481

    Restrict to Generate Leave Application if Not within schedule!

    Hi



    I need help to know the way to manage this scenario!

    I have Tables:

    "TblEmpLeaveSchedule";
    SchID (PK)
    EmpId (FK)
    EmpName
    SStartDate
    SEndDate
    Etc

    Note: Prepared for next year.

    "TblEmpLeaveApp";
    AppID (PK)
    APPDate
    EmpId (FK)
    EmpName
    VStartDate
    VEndDate
    Etc


    Requirement:

    a. The system shall not be able to generate the application for the Employee who schedule is not away more than 30 days. More over system can recommend to issue the leave applications who are just 30 days away from schedule start date?

    b. The system shall not allow to issue duplicate applications during the same year?

    Kindly advise the needful.

  2. #2
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    in the where condition for employee schedule you could put <date() +30

    Its hard to understand what you're after. perhaps you could attach a sample copy of your DB?

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    CONDITIONS:

    1. deny if Emp has had any for the year
    2. DENY if emp app Elapse < 30 days
    3. ok if emp app date < 30 days STARTDATE


    make a query,qsEmpLeaveYr, to get Emps and their leave year, :
    select EmpID, Year(sStartDate) as Yr from TblEmpLeaveSchedule


    On the entry form, the user enters leave data then
    validate the App request by clicking button:

    Code:
    sub btnAppy_click()
    dim vHasThisYr, vElapse, vDaysAway
    
        'check all conditions above from the entry form:
    
    vHasThisYr = Dlookup("[EmpId]","qsEmpLeaveYr","[EmpId]=" & txtID & " and [Yr]=" & Year(txtStartDate))
    
    if IsNull( vHasThisYr ) then
       'ok for app this year ,rule 1
       'now check elapsed leave time    
     
       vElapse = DateDiff("d",txtStartDate, txtEndDate)
       if vElapse < 30 then    'rule 3, ok if leave <30
           msgbox "Leave is too short"
       else
           vDaysAway= DateDiff("d",date(), txtStartDate)
           if vDaysAway <30 then
                msgbox "Leave request is too close to leave"
           else
               docmd.openquery "qaAddRqst2Schedule"
           endif
       endif
    ELSE
       msgbox "Applicant aleady took leave this year"
    endif
    
    end sub

  4. #4
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hi

    Its been long time.

    The requirements:

    a. Shall restrict duplicate entries for Annual Vacations schedule.
    *After update of Combo Box (Fed by TblEmp) by selecting the employee, system should give alert if this man is already in schedule for given year schedule.

    b. When to initiate a vacation leave app, then again while selecting the emp from the cbo system should not allow if this man is not in schedule of this year.

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

Similar Threads

  1. Replies: 6
    Last Post: 01-16-2017, 04:41 PM
  2. Auto generate schedule within a form
    By andibeans in forum Forms
    Replies: 1
    Last Post: 03-14-2016, 06:05 PM
  3. Replies: 2
    Last Post: 02-27-2016, 10:59 AM
  4. Replies: 1
    Last Post: 08-27-2015, 06:05 AM
  5. Replies: 4
    Last Post: 01-05-2014, 02:09 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