I created the following query in MS Query (Excel 2007) and it runs without error.
--------------------------------------------------
SELECT
teachers.lastfirst,
courses.course_name,
pgfinalgrades.finalgradename,
sections.Course_Number,
sections.Section_Number,
substring(sections.expression,1,1),
substring(sections.expression,3,1),
students.lastfirst,
cast(students.Student_Number as int),
pgfinalgrades.percent,
pgfinalgrades.grade
From CC
left join pgfinalgrades on cc.studentid = pgfinalgrades.studentid
and cc.sectionid = pgfinalgrades.sectionid
and pgfinalgrades.finalgradename = 'T1'
inner join students on cc.studentid = students.id
inner join sections on cc.sectionid = sections.id
inner join courses on sections.course_number = courses.course_number
inner join teachers on sections.teacher = teachers.id
WHERE
cc.schoolid = 303
and students.enroll_status = 0
and sections.termid in (1800, 1801)
ORDER BY
teachers.lastfirst,
courses.course_name,
sections.expression,
students.lastfirst
----------------------------------------------
I'd like to have cc.schoolid (in the WHERE clause) to be a prompted parameter where the query is executed.