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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3061 - Too few parameters

Status
Not open for further replies.

TedRSki

Programmer
Oct 17, 2010
24
US
I have tried two different ways to create a query to run to load an Excel spreadsheet. One gives the Run time error 3061 or asks for a list separator. This is the code:
Code:
Set RS = DB.OpenRecordset("SELECT * from qryRTRACK_EMP Where" _
        & "([SDate] Between #" & Forms![frmReports]![Text0] & "# And # " _
        & DateAdd("d", 6, Forms![frmReports]![Text0]) & "#)" _
        & " And ([EDate] Between #" & Forms![frmReports]![Text0] & "# And #" _
        & DateAdd("d", 6, Forms![frmReports]![Text0]) & "#) ")

where Text0 is the start date for the payroll week. I have a button that runs a module that uses the Text0 start date, 10/14/2010, for validation then runs a sub routine where the query is located.

The other method I tried was:
Code:
Set RS = DB.OpenRecordset("SELECT * from qryRTRACK_EMP Where " & Scrit & "ORDER BY LREF, EMPNAME", dbOpenDynaset, dbReadOnly)

where scrit = [SDATE] BETWEEN #10/14/2010# AND #10/20/2010# AND [EDATE] BETWEEN #10/14/2010# AND #10/20/2010#

I received the same error with the second method. Any ideas on fixing this?
 
A quick glance at your code shows that you are missing some spaces inside your quoted sections. Right of WHERE and left of ORDER BY. I always create a string variable for my sql statements and then use Debug.Print strSQL to troubleshoot.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top