我有一个计算员工周年日期的查询。我希望该查询根据当前日期为我的表生成一个条目事件。当他们的周年纪念日到来时,基本上会自动生成周年假期累积。这是我的桌子的一个例子。
Table name "SchedulingLog"
LogID "PrimaryKey AutoNbr"
UserID "Employee specific"
LogDate
EventDate
Category "ex Vacation, Anniversary..."
CatDetail "ex. Vacation Day Used, Anniversary..."
Value "ex. -1, 1..."
我的查询
Query Name "qry_YOS"
UserID "Employee Specific"
DOH "Employee hire date"
YearsOfService "calculated Field"
Annual "calculated Field"
Schedule "Employee Specific"
Annual Vac Days "calculated field"
Anniversary "calculated Field"
查询关联SQL
INSERT INTO schedulinglog
(userid,
[value],
eventdate,
logdate,
category,
catdetail)
SELECT roster.userid,
[annual] * [schedule] AS [Value],
Month([wm doh]) & "/" & Day([wm doh]) & "/" & Year(DATE()) AS EventDate,
DATE() AS LogDate,
category.[category name] AS Category,
catdetail.catdetail
FROM roster,
tblaccrual,
category
INNER JOIN catdetail
ON category.categoryid = catdetail.categoryid
WHERE (( ( [tblaccrual] ! [years] ) < Round(( DATE() - [wm doh] ) / 365, 2) ))
GROUP BY roster.userid,
roster.[wm doh],
Round(( DATE() - [wm doh] ) / 365, 2),
roster.schedule,
Month([wm doh]) & "/" & Day([wm doh]) & "/" & Year(DATE()),
DATE(),
category.[category name],
catdetail.catdetail
HAVING ( ( ( category.[category name] ) LIKE "vacation*" )
AND ( ( catdetail.catdetail ) LIKE "anniversary*" ) );
我知道有可能我只是不知道从哪里开始。