Microsoft KB Archive/207586

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

Article ID: 207586

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q207586



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

This article applies only to a Microsoft Access database (.mdb).



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

Error Type:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/nwweb/MainQuery.ASP, line 22



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 NWind2000. Start Microsoft Access and open the sample database Northwind.mdb. Create the following query based on the Customers table:

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: [Enter Customer ID]

Data Type: Text

 Save this query as SubQuery.</li> Create the following query based on the SubQuery query:

Field: CompanyName

Table: SubQuery

</li> Save this query as MainQuery.</li> On the File menu, click Export.</li> In the Save as type box, select Microsoft Active Server Pages (*.asp).</li> In the Save in box, select a folder on your Web server. The File name box should display the query name, in this case, MainQuery. Click Save.</li> In the Microsoft Active Server Pages Output Options dialog box, type NWind2000 in the Data Source Name box. In the Server URL box, type the URL of your server, and then click OK.</li> In the Enter Parameter Value dialog box that appears, simply click OK.</li> Close the query. Access creates two files: MainQuery.asp and MainQuery.html. Open MainQuery.html from Internet Explorer and type ALFKI in the Enter Customer Id box. Click Run Query.</li></ol>

The query should fail and cause Internet Explorer to display a page beginning with "The page cannot be displayed." This page also includes the error indicated in the "Symptoms" section at the beginning of this article.

NOTE: If you attempt to follow these steps while implementing the directions that are found in the "Resolutions" section, placing the parameters only in the top level query, you receive the following error message:

Error Type:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing

operator) in query expression '((([Customers].[CustomerID])=r cid]))'.

/nwweb/MainQuery.ASP, line 22

For additional information about correcting the error in the query expression, click the article number below to view the article in the Microsoft Knowledge Base:

243834 ACC2000: Syntax Error When You Export a Parameter Query to Active Server Page (ASP) Format

Additional query words: errors prb

Keywords: kbprb KB207586

-

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

© Microsoft Corporation. All rights reserved.