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

Error 3061 on openrecordset

Status
Not open for further replies.

GulfImages

Technical User
Jul 9, 2004
60
US
Hi all,

I have a piece of code that I'm just stumped with:

Dim OrdIn As Database, Invoice As Recordset
Set OrdIn = DBEngine.Workspaces(0).Databases(0)

Set Invoice = OrdIn.OpenRecordset("qryInvByDate", dbOpenDynaset)

The qryInvByDate is a simple query with 2 fields, the date field has criteria of between Forms!frmName!FldName1 and Forms!frmName!FldName2. When I view the query with the form open, it works perfectly, when I try to run the code above, I get and error 3061 "Too few parameters, expected 2". I have no parameters in the query.

Any suggestions?

Thanks,
BobbyC
 
Found the answer in a search here:

There's a post there from Katerine that suggests prefacing the query criteria with the Eval function. Her post was exactly the error I was getting under the exact same circumstances. I changed my criteria statement in the actual query (qry_GetThisRecordBasedOnSSN) as follows:

Like Eval("[Forms]![Switchboard]![txt_UseThisSSN]")

Changed my criteria to use the Eval and it works perfectly!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top