I have a query that I need to return results for the current fiscal year (runs 1 June to 31 May) for a database of events. I got code help from another forum that I thought would work, but it's returning a blank sheet and I can't figure out why.
The sql for the entire query is:
I read in another post that criteria using iif have to be used on queries that return single records with no ambiguous joins. Is there something I'm missing in the HAVING clause, or should I preface this query with another query to just draw off tblEventInformation,[EventStartDate] to filter the dates I need, then have the written query above draw those dates from that query filter (that's an idea I just had while I was typing this)?
The sql for the entire query is:
Code:
SELECT tbluEventType.EventType, Count(jxtEventAttendance.SurgeonID) AS CountOfSurgeonID, tblEventInformation.[EventStartDate], (DateDiff("d",[EventStartDate],[EventEndDate])+1) AS Days
FROM (tbluEventType RIGHT JOIN tblEventInformation ON tbluEventType.EventTypeID = tblEventInformation.[EventTyp ID]) INNER JOIN jxtEventAttendance ON tblEventInformation.EventInfoID = jxtEventAttendance.EventInfoID
GROUP BY tbluEventType.EventType, tblEventInformation.[EventStartDate], (DateDiff("d",[EventStartDate],[EventEndDate])+1), tblEventInformation.[EventEndDate]
HAVING (((tblEventInformation.[EventStartDate])=iif(month(date())>=1 and month(date())<=5,"Between #" & dateserial(year(date()) -1,6,1) & "# And #" & dateserial(year(date()),6,0) & "#","Between #" & dateserial(year(date()),6,1) & "# And #" & dateserial(year(date())+1,6,0) & "#" )))
ORDER BY tblEventInformation.[EventStartDate];
I read in another post that criteria using iif have to be used on queries that return single records with no ambiguous joins. Is there something I'm missing in the HAVING clause, or should I preface this query with another query to just draw off tblEventInformation,[EventStartDate] to filter the dates I need, then have the written query above draw those dates from that query filter (that's an idea I just had while I was typing this)?