删除"输入参数值"在查询MS访问

时间:2016-08-28 12:25:50

标签: ms-access

所以我和初学者一样多。我几乎不知道如何编码,而且我在学习Access时也是如此。

我有两个表:EmployeesT(有员工基本信息)和IncreaseT(每次每个员工的薪水都有记录)

我目前遇到了一个应该执行以下操作的查询:

  1. 只显示每位员工增加的最后一条记录> 0
  2. 计算自上次以来的月数 员工最后一次增加
  3. 显示"确定","符合条件的",或"逾期"基于评级(a 在EmployT中的字段和员工的月数 他的最后一次增加
  4. 我的问题是,当我尝试打开查询时,它会要求我输入参数值"为:

      

    最后评分(评分字段包含上次总计),

         

    Max of DateOfLastUpdate(具有最大总数的DateOfLastUpdate字段)和

         

    MonthsSinceLastUpdate(DateDiff(" m",[MaxOfDateOfUpdate],Now())

    这是查询的代码:

    SELECT EmployeesT.LocalID, Last(IncreaseT.Ratings) AS LastOfRatings, Max(IncreaseT.DateOfUpdate) AS MaxOfDateOfUpdate, DateDiff("m",[MaxOfDateOfUpdate],Now()) AS MonthsSinceLastIncrease, IIf([MonthsSinceLastIncrease]<24,IIf([MonthsSinceLastIncrease]>=18 And [LastOfRatings]<=2,"Overdue",IIf([MonthsSinceLastIncrease]>=15 And [LastOfRatings]=1,"Overdue",IIf([MonthsSinceLastIncrease]>=9 And [MonthsSinceLastIncrease]<15 And [LastOfRatings]=1,"Eligible",IIf([MonthsSinceLastIncrease]>=12 And [MonthsSinceLastIncrease]<18 And [LastOfRatings]=2,"Eligible","ok")))),"Overdue") AS Eligiblity
    
    FROM EmployeesT INNER JOIN IncreaseT ON EmployeesT.LocalID = IncreaseT.Employee
    WHERE (((IncreaseT.Increase)>0))
    GROUP BY EmployeesT.LocalID, DateDiff("m",[MaxOfDateOfUpdate],Now()), IIf([MonthsSinceLastIncrease]<24,IIf([MonthsSinceLastIncrease]>=18 And [LastOfRatings]<=2,"Overdue",IIf([MonthsSinceLastIncrease]>=15 And [LastOfRatings]=1,"Overdue",IIf([MonthsSinceLastIncrease]>=9 And [MonthsSinceLastIncrease]<15 And [LastOfRatings]=1,"Eligible",IIf([MonthsSinceLastIncrease]>=12 And [MonthsSinceLastIncrease]<18 And [LastOfRatings]=2,"Eligible","ok")))),"Overdue");
    

    任何帮助都会非常感激,我试着阅读其他帖子并将相同的逻辑应用到我的但没有运气,我在设计视图中做了我的全部事情,代码中的一切对我来说太混乱了

0 个答案:

没有答案
相关问题