Meloncolly
Programmer
I'm trying to perform a lookup type of operation on a table. The table is tblEmpHistory. Two fields i'm interested in: DateChange, TeamID. The DateChange field records the date an employee changed team, and TeamID records the NEW team ID at that date. Using a parameter date field, can someone come up with a formula that would give the teamID for ANY given date? For example, dateChange is 22/12/03, TeamId is 5. On 21/12 and prior, give either "No Team" or the team for previous DateChange, and for 22/12/03 onwards, give "Team 5" (unless there is a later changedate, of course)
Here's how I'd do it in Access/other database query - I just can't seem to get this into a formula. Apologies, Crystal still quite new to me.
SELECT TOP 1 tblEmpHistory.TEamID
FROM tblEmpHistory
WHERE (((tblEmpHistory.DateChange)<=[Enter Report Date])
ORDER BY tblEmpHistory.DateChange DESC;
Many thanks in advance.
Here's how I'd do it in Access/other database query - I just can't seem to get this into a formula. Apologies, Crystal still quite new to me.
SELECT TOP 1 tblEmpHistory.TEamID
FROM tblEmpHistory
WHERE (((tblEmpHistory.DateChange)<=[Enter Report Date])
ORDER BY tblEmpHistory.DateChange DESC;
Many thanks in advance.