Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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

↑ Back to the top


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.

↑ Back to the top


Resolution

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

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. 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.
  2. Start Microsoft Access and open the sample database Northwind.mdb.
  3. Create the following query based on the Customers table:
    Field: CustomerID
    Table: Customers
    Criteria: [Enter Customer ID]

    Field: CompanyName
    Table: Customers
  4. 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
  5. Save this query as SubQuery.
  6. Create the following query based on the SubQuery query:
    Field: CompanyName
    Table: SubQuery
  7. Save this query as MainQuery.
  8. On the File menu, click Export.
  9. In the Save as type box, select Microsoft Active Server Pages (*.asp).
  10. 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.
  11. 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.
  12. In the Enter Parameter Value dialog box that appears, simply click OK.
  13. 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.
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

↑ Back to the top


Keywords: KB207586, kbprb

↑ Back to the top

Article Info
Article ID : 207586
Revision : 2
Created on : 6/24/2004
Published on : 6/24/2004
Exists online : False
Views : 346