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

ID: Q191619


The information in this article applies to:
  • Microsoft Access 97


SYMPTOMS

Advanced: Requires expert coding, interoperability, and multi-user skills.

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 <number>.


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.


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 NWind97.


  2. Open the sample database Northwind.mdb.


  3. 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 


  4. 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 


  5. Save this query as SubQuery.


  6. Create the following query based on the SubQuery query:
    
           Query: MainQuery
           ------------------
           Type: Select Query
    
           Field: CompanyName
              Table: SubQuery 


  7. Save this query as MainQuery.


  8. On the File menu, click Save As HTML. When the "Publish to the Web Wizard" appears, click Next on the opening screen.


  9. On the "What do you want to publish?" screen, click the Queries tab, and then click MainQuery. Click Next.


  10. On the "What HTML document, if any, do you want to use as a default template?" screen, click Next.


  11. On the "What default format type do you want to create?" screen, click Dynamic ASP, and then click Next.


  12. 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.


  13. 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.


  14. Open MainQuery_1.html from Internet Explorer and type ALFKI in the Enter Customer Id box. Click Run Query.


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

Additional query words: errors

Keywords : kbdta IntPubWiz QryParm IntAsp
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: April 19, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.