I don't know if this is enough information for anybody to help, but I hope so.
I have a query that looks at a date that an employee took as a vacation day. I look at that date and return "vacation year" depending on what begindate and enddate it fell between.
I'm trying to do that with this selection criteria in a query:
VacationYear: IIf([Date_off] Between [vacationstartyear] And [vacationendyear],[vacationyear])
It produces the correct data and an additional blank record for each row. And I don't know why.
I'd really appreciate any help.
SQL below.
SELECT tblTransaction.TransactionID, tblTransaction.EmployeeID, PTOType.PTOTypeID, tblEmployee.fname, tblEmployee.lname, tblTransaction.Date_Off, PTOType.PTOType, tblTransaction.Transaction_Date, Format([Date_Off],"yyyy") AS [Year], tblTransaction.Hours_Used, tblTransaction.archived, tblEmployee.StartDate, IIf([Date_off] Between [vacationstartyear] And [vacationendyear],[vacationyears]) AS VacationYear
FROM (PTOType INNER JOIN (tblEmployee INNER JOIN tblTransaction ON tblEmployee.EmployeeID = tblTransaction.EmployeeID) ON PTOType.PTOTypeID = tblTransaction.Transaction_Type) INNER JOIN qryVacationYears ON tblEmployee.EmployeeID = qryVacationYears.EmployeeID
GROUP BY tblTransaction.TransactionID, tblTransaction.EmployeeID, PTOType.PTOTypeID, tblEmployee.fname, tblEmployee.lname, tblTransaction.Date_Off, PTOType.PTOType, tblTransaction.Transaction_Date, Format([Date_Off],"yyyy"), tblTransaction.Hours_Used, tblTransaction.archived, tblEmployee.StartDate, IIf([Date_off] Between [vacationstartyear] And [vacationendyear],[vacationyears])
ORDER BY tblTransaction.TransactionID, tblTransaction.EmployeeID, PTOType.PTOTypeID;
I have a query that looks at a date that an employee took as a vacation day. I look at that date and return "vacation year" depending on what begindate and enddate it fell between.
I'm trying to do that with this selection criteria in a query:
VacationYear: IIf([Date_off] Between [vacationstartyear] And [vacationendyear],[vacationyear])
It produces the correct data and an additional blank record for each row. And I don't know why.
I'd really appreciate any help.
SQL below.
SELECT tblTransaction.TransactionID, tblTransaction.EmployeeID, PTOType.PTOTypeID, tblEmployee.fname, tblEmployee.lname, tblTransaction.Date_Off, PTOType.PTOType, tblTransaction.Transaction_Date, Format([Date_Off],"yyyy") AS [Year], tblTransaction.Hours_Used, tblTransaction.archived, tblEmployee.StartDate, IIf([Date_off] Between [vacationstartyear] And [vacationendyear],[vacationyears]) AS VacationYear
FROM (PTOType INNER JOIN (tblEmployee INNER JOIN tblTransaction ON tblEmployee.EmployeeID = tblTransaction.EmployeeID) ON PTOType.PTOTypeID = tblTransaction.Transaction_Type) INNER JOIN qryVacationYears ON tblEmployee.EmployeeID = qryVacationYears.EmployeeID
GROUP BY tblTransaction.TransactionID, tblTransaction.EmployeeID, PTOType.PTOTypeID, tblEmployee.fname, tblEmployee.lname, tblTransaction.Date_Off, PTOType.PTOType, tblTransaction.Transaction_Date, Format([Date_Off],"yyyy"), tblTransaction.Hours_Used, tblTransaction.archived, tblEmployee.StartDate, IIf([Date_off] Between [vacationstartyear] And [vacationendyear],[vacationyears])
ORDER BY tblTransaction.TransactionID, tblTransaction.EmployeeID, PTOType.PTOTypeID;