Gasman
Enthusiastic Amateur
- Local time
- Today, 00:48
- Joined
- Sep 21, 2011
- Messages
- 16,607
Hi everyone,
I have a query which at present shows all records.
I have created a listbox for the record types, Workday, Holiday etc.
I am happy with building whatever to pass to the query from the listbox but would appreciate some help in the syntax of amending a saved query.
I am using the ID of the record types and wish to use criteria like IN(15,16,17) if list entries for 15,16 & 17 were selected.
If I type in the the above criteria in the design window I get what I want, but how do I send that to the query?
I've tried a stored parameter and then using that whole string as the parameter, but Access says it is too complex or typed incorrectly.
So I need to vary the criteria with the IN clause.?
I also need to save it as I use it as a source for the report.
Doing it this way I hope to use one query and one report for multiple criteria?
How do I construct the parameter/query to accomplish this please?
Query SQL is currently
TIA
I have a query which at present shows all records.
I have created a listbox for the record types, Workday, Holiday etc.
I am happy with building whatever to pass to the query from the listbox but would appreciate some help in the syntax of amending a saved query.
I am using the ID of the record types and wish to use criteria like IN(15,16,17) if list entries for 15,16 & 17 were selected.
If I type in the the above criteria in the design window I get what I want, but how do I send that to the query?
I've tried a stored parameter and then using that whole string as the parameter, but Access says it is too complex or typed incorrectly.
So I need to vary the criteria with the IN clause.?
I also need to save it as I use it as a source for the report.
Doing it this way I hope to use one query and one report for multiple criteria?
How do I construct the parameter/query to accomplish this please?
Query SQL is currently
Code:
SELECT tblEmployeeDay.EmployeeID, nz(WeekdayName(Weekday([tblEmployeeDay].[DayDate],2),True),"") AS DayName, tblDates.DayDate, [tblEmployee.Forename] & " " & [tblEmployee.Surname] AS FullName, tblEmployeeDay.StartTime, tblEmployeeDay.EndTime, tblEmployeeDay.Lunch, IIf([DateType]=15 Or [DateType]=16,0,calctime([starttime],[endtime],[lunch])/60) AS Hours, tblEmployee.ReportsTo, [tblEmployee_1.Forename] & " " & [tblEmployee_1.Surname] AS Manager, tblLookup.DataValue, tblEmployeeDay.DateType, Year([tblEmployeeDay.DayDate]) & DatePart("ww",[tblEmployeeDay].[DayDate]) AS GroupDate
FROM tblDates INNER JOIN (((tblEmployee INNER JOIN tblEmployeeDay ON tblEmployee.EmployeeID = tblEmployeeDay.EmployeeID) INNER JOIN tblEmployee AS tblEmployee_1 ON tblEmployee.ReportsTo = tblEmployee_1.EmployeeID) INNER JOIN tblLookup ON tblEmployeeDay.DateType = tblLookup.LookupID) ON tblDates.DayID = tblEmployeeDay.DayID
WHERE (((tblEmployeeDay.EmployeeID)=[Forms]![frmEmployeeHoursRpt]![cboEmployeeID]) AND ((tblDates.DayDate) Between [Forms]![frmEmployeeHoursRpt]![txtStartDate] And [Forms]![frmEmployeeHoursRpt]![txtEndDate]) AND ((tblEmployeeDay.DateType) In (15,16)))
ORDER BY tblDates.DayDate, Year([tblEmployeeDay.DayDate]) & DatePart("ww",[tblEmployeeDay].[DayDate]);
Last edited: