Hi all,
I am working on making a crosstab query that uses another query as its record source. The purpose of this crosstab query is to take 5 days worth of production data and display it as a week summary. My rows are the different product families that we have, and the column headings are supposed to be the dates. I'm desigining the query to always display 5 days (Mon - Fri). There is one parameter that is taken from a form (startDate - which is executed on the source query).
This crosstab worked perfectly the first time I ran it and displayed the five days worth of data. However, when I tried testing it on another week I get a "The Microsoft Database does not recognize " as a valid field or expression". I'm guessing that after I ran it the first time, the 5 dates become locked in as the column headers, and now I can't run any other dates. Would anyone happen to have any suggestions for me? The SQL for both queries is below:
Source query:
PARAMETERS [Forms]![Home]![Quality].[Form]![summaryDate] DateTime;
SELECT standards.prodFamily, standards.JOP, prodData.goalRate, prodData.prodDate, prodData.uplh
FROM standards INNER JOIN prodData ON standards.prodFamily = prodData.prodFamily
GROUP BY standards.prodFamily, standards.JOP, prodData.goalRate, prodData.prodDate, prodData.uplh
HAVING (((prodData.prodDate) Between [Forms]![Home]![Quality].[Form]![summaryDate] And ([Forms]![Home]![Quality].[Form]![summaryDate]+5)));
Crosstab Query:
TRANSFORM Sum(productionDataPull.uplh) AS SumOfuplh
SELECT productionDataPull.prodFamily, productionDataPull.JOP, productionDataPull.goalRate
FROM productionDataPull
GROUP BY productionDataPull.prodFamily, productionDataPull.JOP, productionDataPull.goalRate
PIVOT Format([prodDate],"Short Date");
I also attached a screenshot of what I want it to look like (This screenshot is taken from the one date that works on the crosstab query)
I am working on making a crosstab query that uses another query as its record source. The purpose of this crosstab query is to take 5 days worth of production data and display it as a week summary. My rows are the different product families that we have, and the column headings are supposed to be the dates. I'm desigining the query to always display 5 days (Mon - Fri). There is one parameter that is taken from a form (startDate - which is executed on the source query).
This crosstab worked perfectly the first time I ran it and displayed the five days worth of data. However, when I tried testing it on another week I get a "The Microsoft Database does not recognize " as a valid field or expression". I'm guessing that after I ran it the first time, the 5 dates become locked in as the column headers, and now I can't run any other dates. Would anyone happen to have any suggestions for me? The SQL for both queries is below:
Source query:
PARAMETERS [Forms]![Home]![Quality].[Form]![summaryDate] DateTime;
SELECT standards.prodFamily, standards.JOP, prodData.goalRate, prodData.prodDate, prodData.uplh
FROM standards INNER JOIN prodData ON standards.prodFamily = prodData.prodFamily
GROUP BY standards.prodFamily, standards.JOP, prodData.goalRate, prodData.prodDate, prodData.uplh
HAVING (((prodData.prodDate) Between [Forms]![Home]![Quality].[Form]![summaryDate] And ([Forms]![Home]![Quality].[Form]![summaryDate]+5)));
Crosstab Query:
TRANSFORM Sum(productionDataPull.uplh) AS SumOfuplh
SELECT productionDataPull.prodFamily, productionDataPull.JOP, productionDataPull.goalRate
FROM productionDataPull
GROUP BY productionDataPull.prodFamily, productionDataPull.JOP, productionDataPull.goalRate
PIVOT Format([prodDate],"Short Date");
I also attached a screenshot of what I want it to look like (This screenshot is taken from the one date that works on the crosstab query)