We are trying to use a crosstab query to drive a report, and we are trying to use a control on a form to supply a date as a part of the criteria. It fails saying that the form reference is an invalid object. The SQL looks like this
TRANSFORM Sum(qry_WeeklyStatistics.EventCount) AS SumOfEventCount
SELECT qry_WeeklyStatistics.UserName
FROM qry_WeeklyStatistics
WHERE (((qry_WeeklyStatistics.Event_Date) Between DateAdd(“d”,-6,[Forms]![frm_MyForm]![txt_WeekEnd_dt]) And [Forms]![frm_MyForm]![txt_WeekEnd_dt]))
GROUP BY qry_WeeklyStatistics.UserName
PIVOT qry_WeeklyStatistics.event_Desc;
If we simply replace the Forms![frm_MyForm]![txt_WeekEnd_dt] with a valid date, it works fine. By the same token, if we put the expression into the source query (qry_WeeklyStatistics) as a criteria, that query will run just fine, but the crosstab query still fails. Can someone shed some light on what’s going on here? Thanks in advance.