Below is the code I am using for three queries. The only
difference between the 3 queries are the Series. They work
good until I save the form they are on or leave the database
and come back to it. The second query below stays the same
and works just fine. They are activated from 3 different
combo boxes. The Class I query and the Class III query SQL
Changes somehow. This has really got me stumped!!
The Class I code changes to:
The Class III code changes to:
difference between the 3 queries are the Series. They work
good until I save the form they are on or leave the database
and come back to it. The second query below stays the same
and works just fine. They are activated from 3 different
combo boxes. The Class I query and the Class III query SQL
Changes somehow. This has really got me stumped!!
Code:
Class I
SELECT vTbl.TodaysDate, Count(*) AS [WU per day]
FROM (SELECT DISTINCT WorkUnit, TodaysDate FROM GrnWorkUnitsFaultsMainTBL
WHERE Series In ("A219","A883","A908","C814","C839","E098","E210","F114","F807","G108","J160","A268","A968","G807","K160")
And NonConformanceDescription Not In ("Out of Stock")
AND TodaysDate BETWEEN [Forms]![Queries_ReportsFRM]![StartDateTxt] And [Forms]![Queries_ReportsFRM]![EndDateTxt]
) AS vTbl
GROUP BY vTbl.TodaysDate;
Code:
Class II
SELECT vTbl.TodaysDate, Count(*) AS [WU per day]
FROM (SELECT DISTINCT WorkUnit, TodaysDate FROM GrnWorkUnitsFaultsMainTBL
WHERE Series In ('A265','A295','C264','C801','C861','D174','D470','D815','D826','G118')
And NonConformanceDescription Not In ("Out of Stock")
AND TodaysDate BETWEEN [Forms]![Queries_ReportsFRM]![StartDateTxt] And [Forms]![Queries_ReportsFRM]![EndDateTxt]
) AS vTbl
GROUP BY vTbl.TodaysDate;
Code:
Class III
SELECT vTbl.TodaysDate, Count(*) AS [WU per day]
FROM (SELECT DISTINCT WorkUnit, TodaysDate FROM GrnWorkUnitsFaultsMainTBL
WHERE Series In ('A229','A230','A231','A233','A234','A476','A477','A478','A479','A495','A891','A894','A895','A896','A897','A901','A902','A903','A904','A905','B218','B230','B233','B453','B454','B455','B827','B890','B896','C802','C819','C820','C821','D215')
And NonConformanceDescription Not In ("Out of Stock")
AND TodaysDate BETWEEN [Forms]![Queries_ReportsFRM]![StartDateTxt] And [Forms]![Queries_ReportsFRM]![EndDateTxt]
) AS vTbl
GROUP BY vTbl.TodaysDate;
The Class I code changes to:
Code:
SELECT vTbl.TodaysDate, Count(*) AS [WU per day]
FROM [SELECT DISTINCT WorkUnit, TodaysDate FROM GrnWorkUnitsFaultsMainTBL WHERE Series In ("A219","A883","A908","C814","C839","E098","E210","F114","F807","G108","J160","A268","A968","G807","K160") And NonConformanceDescription Not In ("Out of Stock") And Today] AS vTbl
GROUP BY vTbl.TodaysDate;
The Class III code changes to:
Code:
SELECT vTbl.TodaysDate, Count(*) AS [WU per day]
FROM [SELECT DISTINCT WorkUnit, TodaysDate FROM GrnWorkUnitsFaultsMainTBL WHERE Series In ('A229','A230','A231','A233','A234','A476','A477','A478','A479','A495','A891','A894','A895','A896','A897','A901','A902','A903','A904','A905','B218','B230','B233','B453','] AS vTbl
GROUP BY vTbl.TodaysDate;