I have an SQL that is working and returning the information i need from MS-Access, however it keeps asking for me to enter paramter values for “Annual Accrual” and “Used”.
SELECT SchedulingLog.UserID, SchedulingLog.Category AS Type,
Sum(SchedulingLog.Value) AS Used, SchedulingLog.Category,
qry_YearsOfService.[Annual Vac Days], [Annual Vac Days]+[Used] AS [Days Left]
FROM SchedulingLog INNER JOIN qry_YearsOfService ON
SchedulingLog.UserID = qry_YearsOfService.UserID
GROUP BY SchedulingLog.UserID, SchedulingLog.Category, SchedulingLog.Category,
qry_YearsOfService.[Annual Vac Days], [Annual Vac Days]+[Used]
HAVING (((SchedulingLog.Category) Like "Vac*"));
I dont want the option to enter parameter, it should just calculate. What am I missing?
Here is the SQL for the Years of Service query
SELECT Roster.UserID, Roster.[WM DOH], Round((Date()-[WM DOH])/365,2) AS YearsOfService,
Max (tblAccrual.WeeksAccrual) AS [Annual Accrual], Roster.Schedule,
[Annual Accrual]*[Schedule] AS [Annual Vac Days]
FROM Roster, tblAccrual
WHERE ((([tblAccrual]![Years])<Round((Date()-[WM DOH])/365,2)))
GROUP BY Roster.UserID, Roster.[WM DOH],
Round((Date()-[WM DOH])/365,2), Roster.Schedule, [Annual Accrual]*[Schedule];
I think it’s asking for
[Annual Accrual]because you have[Annual Accrual]*[Schedule]in thegroup byclause of your first query. Try taking that out.Asking for
[Used]for the same reason, as you have[Annual Vac Days]+[Used]referenced in thegroup byclause of your second query.