Microsoft KB Archive/191619

= ACC97: "Too Few Parameters" Error on ASP with Parameter in Subquery =

Article ID: 191619

Article Last Modified on 1/23/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q191619



Advanced: Requires expert coding, interoperability, and multiuser skills.



SYMPTOMS
When you browse to an Active Server Page (ASP) created from Microsoft Access 97, you may receive the following error message:

Too few parameters. Expected.



CAUSE
You may receive this error message when there is a parameter that is not in the top-level query. Microsoft Access does not check below the top-level to see if a parameter exists when exporting the query.



RESOLUTION
To prevent this error message, do not include parameters on any query other than the top-level query.



Steps to Reproduce Behavior
 On your Web Server, create a System DSN (using the Microsoft Access ODBC driver) based on the sample database, Northwind.mdb, and name the data source NWind97. Open the sample database Northwind.mdb.  Create the following query based on the Customers table:

      Query: SubQuery Type: Select Query

Field: CustomerID Table: Customers Criteria: [Enter Customer ID] Field: CompanyName Table: Customers   On the Query menu, click Parameters. Type the following in the Query Parameters dialog box, and then click OK:

      Parameter                  Data Type [Enter Customer ID]       Text </li> Save this query as SubQuery.</li>  Create the following query based on the SubQuery query:

<pre class="fixed_text">      Query: MainQuery --      Type: Select Query

Field: CompanyName Table: SubQuery </li> Save this query as MainQuery.</li> On the File menu, click Save As HTML. When the "Publish to the Web Wizard" appears, click Next on the opening screen.</li> On the "What do you want to publish?" screen, click the Queries tab, and then click MainQuery. Click Next.</li> On the "What HTML document, if any, do you want to use as a default template?" screen, click Next.</li> On the "What default format type do you want to create?" screen, click Dynamic ASP, and then click Next.</li> On the "What are, or will be, the settings for the Internet database?" screen, type NWind97 in the Data Source Name box, and then click Next.

NOTE: You will have to have an ODBC Data Source Name already created on your Web server that points to the Northwind database named NWind97.</li> On the "Where do you want to publish to?" screen, select a folder on your Web server where you have Execute permission, for example InetPub\Scripts or Webshare\Scripts, and then click Finish. On the Enter Parameter Value dialog box, click OK. Close the query. The "Publish to the Web" Wizard creates two files: MainQuery_1.asp, and MainQuery_1.html.</li> Open MainQuery_1.html from Internet Explorer and type ALFKI in the Enter Customer Id box. Click Run Query.</li></ol>

The query should fail with the error indicated in the "Symptoms" section at the beginning of this article.

Additional query words: too few parameters expected 1 2 3 4 5 6 7 8 9 0 errors

Keywords: kbprb KB191619

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.