How do I change this to get conditions from a form:
[tt]
WHERE WeekNo Is Not Null AND DISPLAY_STATUS<>"Cancelled" AND TERM [red]In ('200640','200740','200840')[/red]
[/tt]
I tried putting a textbox on the form called txtReportingTerms and entered this into it:
'200640','200740','200840'
Then modified the query as follows:
[tt]
WHERE WeekNo Is Not Null AND DISPLAY_STATUS<>"Cancelled" AND TERM [red]In ([forms]![frmMain]![txtReportingTerms]) [/red]
[/tt]
No results were returned. This is a regular query, not a VBA sql statement. Do I need to modify the query def?
Here is the entire query for reference. As can be seen in the query, I am referring to the form for data elements without a problem.
[tt]
WHERE WeekNo Is Not Null AND DISPLAY_STATUS<>"Cancelled" AND TERM [red]In ('200640','200740','200840')[/red]
[/tt]
I tried putting a textbox on the form called txtReportingTerms and entered this into it:
'200640','200740','200840'
Then modified the query as follows:
[tt]
WHERE WeekNo Is Not Null AND DISPLAY_STATUS<>"Cancelled" AND TERM [red]In ([forms]![frmMain]![txtReportingTerms]) [/red]
[/tt]
No results were returned. This is a regular query, not a VBA sql statement. Do I need to modify the query def?
Here is the entire query for reference. As can be seen in the query, I am referring to the form for data elements without a problem.
Code:
TRANSFORM Sum(Amdata.TOT) AS SumOfTOT
SELECT Amdata.STU_POP, forms!frmMain.txtCurrentTerm AS TERM, Amdata.COLLEGE_SORT, Amdata.COLLEGE, Amdata.PROGRAM, Amdata.STATUS, Amdata.DISPLAY_STATUS, Sum(Amdata.TOT) AS [Total Of TOT]
FROM Amdata INNER JOIN AMCrossHeader ON Amdata.WeekNo = AMCrossHeader.WeekNo
WHERE (((Amdata.WeekNo) Is Not Null) AND ((Amdata.DISPLAY_STATUS)<>"Cancelled") AND ((Amdata.TERM) In ('200640','200740','200840')))
GROUP BY Amdata.STU_POP, forms!frmMain.txtCurrentTerm, Amdata.COLLEGE_SORT, Amdata.COLLEGE, Amdata.PROGRAM, Amdata.STATUS, Amdata.DISPLAY_STATUS
ORDER BY Amdata.STU_POP, forms!frmMain.txtCurrentTerm, Amdata.COLLEGE_SORT, Amdata.PROGRAM, Amdata.STATUS
PIVOT AMCrossHeader.YrHeader In ("Yr0101","Yr0102","Yr0103","Yr0104","Yr0105","Yr0106","Yr0201","Yr0202",
"Yr0203","Yr0204","Yr0205","Yr0206","Yr0301","Yr0302","Yr0303","Yr0304",
"Yr0305","Yr0306");