Microsoft KB Archive/163443

= ACC97: Action Queries Cannot Be Exported to HTML, IDC, or ASP =

Article ID: 163443

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q163443



SYMPTOMS
When you try to save an action query in HTML, IDC, or ASP format, you may receive one of the following error messages:

Query input must contain at least one table or query.

You can only save select, crosstab, or union queries to this format.

An action query cannot be used as a rowsource.



CAUSE
Action queries cannot be exported to HTML, IDC, or ASP format.



RESOLUTION
If you want to generate Internet Database Connector (IDC) files that perform action queries, use Notepad or another text editor to write the IDC file manually. The "More Information" section later in this article has an example of an IDC file that inserts a record into a Microsoft Access 97 database.

Instead of exporting an action query to Active Server Pages (ASP) format to update your database, consider exporting a form to ASP format. Forms in ASP format support adding, updating, and deleting records.



STATUS
This behavior is by design.



MORE INFORMATION
Following is an example of how to create an HTML Insert Form that uses IDC files to insert records into a Microsoft Access 97 database.

NOTE: This section contains information about editing IDC files, and assumes that you are familiar with editing IDC files. Microsoft Access Product Support professionals do not support customization of any HTML, HTX, IDC, or ASP files.

Creating the Files in Microsoft Access
 Start Microsoft Access 97 and open the sample database Northwind.mdb.  Create the following new query called EnterShipper based on the Shippers table:

       Query: EnterShipper ---       Type: Select Query

Field: CompanyName Table: Shippers  On the Query menu, click Parameters.  Type the following in the Query Parameters dialog box, and then click OK.

       Parameter          Data Type [EnterName]       Text </li> Save the EnterShipper query and close it.</li> Select the EnterShipper 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 'EnterShipper' In" dialog box, select Microsoft IIS 1-2 (*.htx;*.idc) in the Save As Type box, and type EnterShipper.htx in the File Name box. Note the folder where the exported files will be stored. Click Export.</li> In the HTX/IDC Output Options dialog box, type the name of a System DSN on your Web server that points to the Northwind sample database. Click OK.

For more information on 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 ACC97: "Data Source Name Not Found" Err Msg Opening Web Page</li> Click OK in the Enter Parameter Value dialog box that appears.</li> The HTX/IDC output creates three files: EnterShipper.HTML, EnterShipper.htx, and EnterShipper.IDC.</li> Copy EnterShipper.HTML, EnterShipper.htx, and EnterShipper.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 ACC97: Error "HTTP/1.0 403 Access Forbidden" Browsing IDC Page</li></ol>

Customizing the IDC files to Permit Inserting Records
<ol>  Use Notepad or another text editor to open the EnterShipper.IDC file. You need to change the SQL Statement so that it will use the value passed from the HTML form and insert it into the Shippers table of the Northwind sample database. Change the SQL Statement so that it looks like this:

<pre class="fixed_text">      INSERT into Shippers (CompanyName) values ('%[EnterName]%'); </li> Save the EnterShipper.IDC file and close it.</li> Start Microsoft Internet Explorer 3.0, or another Web browser program.</li> Type the Uniform Resource Locator (URL) in the address box of your Web browser to view EnterShipper.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/EnterShipper.HTML

Note that the URL depends upon where your files are located on the Web Server.</li> The EnterShipper.HTML form opens in your Web browser with an [EnterName] box and a Run Query button. Type a name into the box, and then click the Run Query button. A new record with the name you typed is inserted into the Shippers table in the Northwind sample database. Note that no records are returned to your web browser because an insert query does not return records.</li></ol>

<div class="references_section">