Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time Error 3061 - Too Few Parameters. Expected 1

Status
Not open for further replies.

devRyan

Programmer
Sep 1, 2006
104
0
0
US
Ok, new thread. :)

Recap. Got the following SQL String which returns an error 3061, though the string is properly formed.

Code:
 strSQL = "SELECT lnkCourseEmployee.EmpCourseID, lnkCourseEmployee.CourseID, lnkCourseEmployee.EmpID, " & _
        "lnkCourseEmployee.DateComplete,lnkCourseEmployee.HoursTrained,lnkCourseEmployeeCompleted, " & _
        "tblCourses.CourseName FROM lnkCourseEmployee, tblCourses WHERE lnkCourseEmployee.EmpID = '" & EmpID & "' " & _
        "AND lnkCourseEmployee.CourseID = tblCourses.CourseID"
    MsgBox strSQL
    Set rsC = db.OpenRecordset(strSQL)

I agree that the EmpID doesn't necessarily need the single quotes, but they don't break the query. Whether they are included in the string or not, I get the same error. The SQL engines are usually pretty forgiving if you include singles and don't need them. This seems more like some parameter is missing in the OpenRecordset call.

Is there somewhere I can test the query outside of code execution, like SQL Server's Query Analyzer?

Thanks for the help.

devRyan
 
You can print the SQL to the immediate window and paste it into the SQL view of the query design window.
 
Did you figure the query out? It looks like there are a few errors in what you posted. but if you figured it out already, it doesn't matter.
 
Yeah, I found the problem. It was the parameter lnkCourseEmployeeCompleted; was missing the dot ->lnkCourseEmployee.Completed.

Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top