Microsoft KB Archive/162980

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

Article ID: 162980

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition
 * Microsoft Internet Information Server 2.0
 * Microsoft Internet Information Server 3.0

-



This article was previously published under Q162980



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.

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:

  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]   On the Query menu, click Parameters. Type the following in the Query Parameters dialog box, and then click OK.

     Parameter          Data Type [EnterName]       Text  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
  Open the sample database Northwind.mdb, and create the following new query called qryParameter based on the Employees table:

<pre class="fixed_text">      Query: qryParameter Type: Select Query

Field: LastName Table: Employees Field: FirstName Table: Employees Criteria: [EnterName] </li> 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.</li> In the Save As dialog box, click "To an External File or Database," and then click OK.</li> 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.</li> 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:

159682 "Data Source Name Not Found" Err Msg Opening Web Page</li> 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.</li> 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:

160754 Error "HTTP/1.0 403 Access Forbidden" Browsing IDC Page</li> 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://%3Cservername%3E/test/qryParameter.HTML

Note that the URL depends upon where your files are located on the Web Server.</li> 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.

</li></ol>

<div class="references_section">