K
Kurt
I had an update query that would run fine when clicking a
button. But when I added one more statement (a parameter)
to the WHERE clause, I got a Run-time error 3061, "Too few
parameters expected. Expected 1."
Here's the statement I added which screws up the query and
causes the error:
"AND ((tblSchools.School)=[Enter School Name]));",
I recreated the query in design view using the same SQL
statement and it worked fine. But when used in code, I get
the error message.
Any ideas? - Kurt (SQL below)
------------------------------------------------
db.Execute "UPDATE tlkpTeacherGrades RIGHT JOIN
(tlkpGrades RIGHT JOIN " & _
"(tlkpDistricts INNER JOIN ((tblSchools INNER JOIN
(tblStudents LEFT JOIN tblTeachers " & _
"ON tblStudents.TeachID = tblTeachers.TeachID) " & _
"ON tblSchools.SchoolID = tblStudents.SchoolID) LEFT
JOIN tblScreenerTeacher " & _
"ON tblStudents.stuid = tblScreenerTeacher.stuid) " & _
"ON tlkpDistricts.DistrictID = tblSchools.DistrictID) "
& _
"ON tlkpGrades.GradeID = tblStudents.GradeID) " & _
"ON tlkpTeacherGrades.GradeID =
tblTeachers.TeacherGradeID " & _
"SET tblScreenerTeacher.TSSent = #" & dteDelDate & "# "
& _
"WHERE (((tblScreenerTeacher.TSSent) Is Null) AND
((tlkpGrades.Grade)<>'Preschool') " & _
"AND ((tblStudents.Status) Is Null) " & _
"AND ((tblSchools.School)=[Enter School Name]));",
dbFailOnError
--------------------------------------------------
Before adding the paramater statement, the query used to
end with
"AND ((tblStudents.Status) Is Null));", dbFailOnError
and it worked fine.
button. But when I added one more statement (a parameter)
to the WHERE clause, I got a Run-time error 3061, "Too few
parameters expected. Expected 1."
Here's the statement I added which screws up the query and
causes the error:
"AND ((tblSchools.School)=[Enter School Name]));",
I recreated the query in design view using the same SQL
statement and it worked fine. But when used in code, I get
the error message.
Any ideas? - Kurt (SQL below)
------------------------------------------------
db.Execute "UPDATE tlkpTeacherGrades RIGHT JOIN
(tlkpGrades RIGHT JOIN " & _
"(tlkpDistricts INNER JOIN ((tblSchools INNER JOIN
(tblStudents LEFT JOIN tblTeachers " & _
"ON tblStudents.TeachID = tblTeachers.TeachID) " & _
"ON tblSchools.SchoolID = tblStudents.SchoolID) LEFT
JOIN tblScreenerTeacher " & _
"ON tblStudents.stuid = tblScreenerTeacher.stuid) " & _
"ON tlkpDistricts.DistrictID = tblSchools.DistrictID) "
& _
"ON tlkpGrades.GradeID = tblStudents.GradeID) " & _
"ON tlkpTeacherGrades.GradeID =
tblTeachers.TeacherGradeID " & _
"SET tblScreenerTeacher.TSSent = #" & dteDelDate & "# "
& _
"WHERE (((tblScreenerTeacher.TSSent) Is Null) AND
((tlkpGrades.Grade)<>'Preschool') " & _
"AND ((tblStudents.Status) Is Null) " & _
"AND ((tblSchools.School)=[Enter School Name]));",
dbFailOnError
--------------------------------------------------
Before adding the paramater statement, the query used to
end with
"AND ((tblStudents.Status) Is Null));", dbFailOnError
and it worked fine.