ACC97: IDC Using Parameter Query May Return "Too Few Parameters"

ID: Q162980


The information in this article applies to:


SYMPTOMS

When you browse to an IDC file that was created from a Microsoft Access 97 parameter query, the following error is returned in your Web browser:

Too few parameters. Expected <number>.

NOTE: This same behavior will occur when you export a form that is based on a parameter query as an Active Server Page.


CAUSE

The parameter query does not have data types specified in the Query Parameters dialog box.


RESOLUTION

Explicitly declare the data types of each parameter in your query.


MORE INFORMATION

The following is an example of a query that has its parameter data types explicitly declared:

  1. Open the sample database Northwind.mdb, and create the following new query called qryParameter based on the Employees table:
    
          Query: qryParameter
          ------------------------
          Type: Select Query
    
          Field: LastName
             Table: Employees
          Field: FirstName
             Table: Employees
             Criteria: [EnterName] 


  2. On the Query menu, click Parameters. Type the following in the Query Parameters dialog box, and then click OK.
    
          Parameter          Data Type
          ----------------------------
          [EnterName]        Text 


  3. Save the qryParameter query and close it. If you exported the qryParameter query to IDC format, the SQL Statements generated would be correctly delimited.


Steps to Reproduce Behavior


  1. Open the sample database Northwind.mdb, and create the following new query called qryParameter based on the Employees table:
    
           Query: qryParameter
           ------------------------
           Type: Select Query
    
           Field: LastName
              Table: Employees
           Field: FirstName
              Table: Employees
              Criteria: [EnterName] 


  2. Save the qryParameter query and close it. Select the qryParameter query in the Database window, and then click Save As/Export on the File menu.


  3. In the Save As dialog box, click "To an External File or Database," and then click OK.


  4. In the "Save Query 'qryParameter' In" dialog box, select Microsoft IIS 1-2 (*.htx;*.idc) in the Save As Type box, and type qryParameter.htx in the File Name box. Note the folder where the files will be exported to. Click Export. The HTX/IDC Output Options dialog box appears.


  5. In the Data Source Name box, enter the name of a System DSN that points to the sample database Northwind.mdb. Click OK.

    For more information about how to define a system DSN, search the Help index for "ODBC, setting up data sources" and see the following article in the Microsoft Knowledge Base:

    Q159682 "Data Source Name Not Found" Err Msg Opening Web Page


  6. Click OK in the Enter Parameter Value dialog box that appears. Note that the HTX/IDC output creates three files: qryParameter.HTML, qryParameter.htx, and qryParameter.IDC.


  7. Copy qryParameter.HTML, qryParameter.htx, and qryParameter.IDC to a folder on your Web Server computer where you have both Read and Execute permission. Read permission is necessary to browse the HTML file and execute permission is necessary to run the IDC file.

    For more information about configuring Microsoft Internet Information Server (IIS) permissions, please refer to the IIS Help Index, and see the following article in the Microsoft Knowledge Base:

    Q160754 Error "HTTP/1.0 403 Access Forbidden" Browsing IDC Page


  8. Start Microsoft Internet Explorer 3.0, or another Web browser program. Type the Uniform Resource Locator (URL) in the address box of your Web browser to view qryParameter.HTML. For example, if you saved your IDC files in a folder called Test in the wwwroot folder of your Web Server, type:

    http://<servername>/test/qryParameter.HTML

    Note that the URL depends upon where your files are located on the Web Server.


  9. The qryParameter.HTML form opens in your web browser with an [EnterName] box and a Run Query button. Type Nancy in the box, and then click the Run Query button. Note that the following error is returned:
    Too few parameters. Expected 1.



REFERENCES

For more information about exporting IDC files, search the Help Index for "IDC files," and then "Export a datasheet to dynamic HTML format," or ask the Microsoft Access 97 Office Assistant. In addition, please refer to the IIS Help Index.

For more information about parameter queries, search the Help Index for "parameter queries," and then "Specify the data type of a parameter in a parameter query," or ask the Microsoft Access 97 Office Assistant.


Keywords          : kberrmsg kbinterop OtpOthr QryParm WzOthr 
Version           : 97
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: April 17, 1999