T
tdietrich71
I have the following crosstab that gives me the desired results:
TRANSFORM Max(qry_Reports_Meeting_Schedule_1.Time) AS MaxOfTime
SELECT tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime AS Times
FROM tbl_ScheduleTimes LEFT JOIN qry_Reports_Meeting_Schedule_1 ON
tbl_ScheduleTimes.Times = qry_Reports_Meeting_Schedule_1.MtgTime
GROUP BY tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime
ORDER BY tbl_ScheduleTimes.ID
PIVOT qry_Reports_Meeting_Schedule_1.MTG_DT In (8/25/2008,8/26/2008,8/27/2008,
8/28/2008,8/29/2008);
However, I want to get the dates in the PIVOT line from a form field, but
when I try to do that I get "Data type mismatch in query expression" using
the code below:
TRANSFORM Max(qry_Reports_Meeting_Schedule_1.Time) AS MaxOfTime
SELECT tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime AS Times
FROM tbl_ScheduleTimes LEFT JOIN qry_Reports_Meeting_Schedule_1 ON
tbl_ScheduleTimes.Times = qry_Reports_Meeting_Schedule_1.MtgTime
GROUP BY tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime
ORDER BY tbl_ScheduleTimes.ID
PIVOT qry_Reports_Meeting_Schedule_1.MTG_DT In ([Forms]![frm_Schedule]!
[StartDate],[Forms]![frm_Schedule]![StartDate]+1,[Forms]![frm_Schedule]!
[StartDate]+2,[Forms]![frm_Schedule]![StartDate]+3,[Forms]![frm_Schedule]!
[StartDate]+4);
Both the form field StartDate AND the column MTG_DT in the table it comes
from are set to Date/Time (Short Date), but I still get the error.
I also tried:
PARAMETERS [Forms]![frm_Schedule]![StartDate] DateTime, [Forms]![frm_Schedule]
![EndDate] DateTime;
TRANSFORM Max(qry_Reports_Meeting_Schedule_1.Time) AS MaxOfTime
SELECT tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime AS Times
FROM tbl_ScheduleTimes LEFT JOIN qry_Reports_Meeting_Schedule_1 ON
tbl_ScheduleTimes.Times = qry_Reports_Meeting_Schedule_1.MtgTime
GROUP BY tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime
ORDER BY tbl_ScheduleTimes.ID
PIVOT qry_Reports_Meeting_Schedule_1.MTG_DT;
Only get 8/25/2008, 8/26/2008, 8/27/2008 for MTG_DT. These are the only
dates that have values. 8/28/2008 and 8/29/2008 have all null values, but I
want those columns to appear in my result set anyway.....how do I fix this??
TRANSFORM Max(qry_Reports_Meeting_Schedule_1.Time) AS MaxOfTime
SELECT tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime AS Times
FROM tbl_ScheduleTimes LEFT JOIN qry_Reports_Meeting_Schedule_1 ON
tbl_ScheduleTimes.Times = qry_Reports_Meeting_Schedule_1.MtgTime
GROUP BY tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime
ORDER BY tbl_ScheduleTimes.ID
PIVOT qry_Reports_Meeting_Schedule_1.MTG_DT In (8/25/2008,8/26/2008,8/27/2008,
8/28/2008,8/29/2008);
However, I want to get the dates in the PIVOT line from a form field, but
when I try to do that I get "Data type mismatch in query expression" using
the code below:
TRANSFORM Max(qry_Reports_Meeting_Schedule_1.Time) AS MaxOfTime
SELECT tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime AS Times
FROM tbl_ScheduleTimes LEFT JOIN qry_Reports_Meeting_Schedule_1 ON
tbl_ScheduleTimes.Times = qry_Reports_Meeting_Schedule_1.MtgTime
GROUP BY tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime
ORDER BY tbl_ScheduleTimes.ID
PIVOT qry_Reports_Meeting_Schedule_1.MTG_DT In ([Forms]![frm_Schedule]!
[StartDate],[Forms]![frm_Schedule]![StartDate]+1,[Forms]![frm_Schedule]!
[StartDate]+2,[Forms]![frm_Schedule]![StartDate]+3,[Forms]![frm_Schedule]!
[StartDate]+4);
Both the form field StartDate AND the column MTG_DT in the table it comes
from are set to Date/Time (Short Date), but I still get the error.
I also tried:
PARAMETERS [Forms]![frm_Schedule]![StartDate] DateTime, [Forms]![frm_Schedule]
![EndDate] DateTime;
TRANSFORM Max(qry_Reports_Meeting_Schedule_1.Time) AS MaxOfTime
SELECT tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime AS Times
FROM tbl_ScheduleTimes LEFT JOIN qry_Reports_Meeting_Schedule_1 ON
tbl_ScheduleTimes.Times = qry_Reports_Meeting_Schedule_1.MtgTime
GROUP BY tbl_ScheduleTimes.ID, tbl_ScheduleTimes.ShortTime
ORDER BY tbl_ScheduleTimes.ID
PIVOT qry_Reports_Meeting_Schedule_1.MTG_DT;
Only get 8/25/2008, 8/26/2008, 8/27/2008 for MTG_DT. These are the only
dates that have values. 8/28/2008 and 8/29/2008 have all null values, but I
want those columns to appear in my result set anyway.....how do I fix this??