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

Parameter query

Status
Not open for further replies.

hcsd

Programmer
May 17, 2000
22
US
I am try to call a parameter query from a form. The form has a text box that supplies the information for the query and the criteria field in the query has the location of the text box containing the data. <br>If I run the query directly it prompts me for the information and then displays the correct information but when I try to run the query from the form I get the message &quot;Run-time error '3061': Too few parameters. Expected 1.&quot;<br><br>The following is the method I am using to call the query:<br><br>Set currecset = curdb.OpenRecordset(&quot;QueryForSubDocsAllBP&quot;)<br>
 
You cannot use a queryDef that is a parameter query as the source for a recordset.&nbsp;&nbsp;Your option is to paste the query's sql string into the OpenRecordset function, and where you want the information to come from the text box, you have to use: <br>... Where fldSomething = &quot; & me.txtWhatever & &quot;...<br><br>You can also get this error if you use a sql string for the recordset source and misspell a field name or use a field that is not in the associated tables or queries.&nbsp;&nbsp;The number of Expected parameters in the error message corresponds to the number of fields in error where a parameter is expected.<br><br>Sorry. <p>-Chopper<br><a href=mailto: > </a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top