ACC97: Cannot View Expressions in Forms Exported to IDC or ASP (165193)



The information in this article applies to:

  • Microsoft Access 97

This article was previously published under Q165193
Moderate: Requires basic macro, coding, and interoperability skills.

SYMPTOMS

If you create an HTX/IDC or ASP file from a form in Microsoft Access 97, when you open it in your Web browser you see empty fields in your IDC datasheet, or you see #Expression in one or more fields of your ASP form.

CAUSE

Microsoft Access does not preserve expressions on forms in HTX/IDC or ASP format.

RESOLUTION

Do not use expressions in a form control's ControlSource property on any form you want to view in HTX/IDC or ASP format.

Instead, try to create a query that contains all of your expressions, base your form on that query, and then bind the controls on your form to the expressions in your query. Using this technique, your expressions will appear in the HTX/IDC or ASP file that you create. A disadvantage of using this method is that your expressions appear in text boxes on an ASP form, which makes them appear to be editable; however, any changes you make to an expression field on an ASP form will be dropped as soon as you commit and refresh the record.

Also, Microsoft Access 97 does output expressions to files in HTML format. If you can use a static HTML format instead of the dynamic HTX/IDC or ASP file formats, consider saving your form as an HTML file as a workaround that will preserve the form's expressions.

MORE INFORMATION

Steps to Reproduce Behavior


  1. Start Microsoft Access and open the sample database Northwind.mdb.
  2. Open the Employees (page break) form in Design view.
  3. Note that the EmployeeName control in the Form Header section has its ControlSource property set to the following expression:
          =[FirstName] & " " & [LastName]
    						
  4. Switch the form to Form view and note that the employee's full name appears above the photograph in the Form Header for each record.
  5. On the File menu, click Save As/Export.
  6. In the Save As dialog box, point "To an External File or Database," and then click OK.
  7. In the "Save Form 'Employees (page break)' In" dialog box, select "Microsoft Active Server Pages (*.asp)" in the Save As Type box. In the Save In box, select a folder on your Web server where you have Execute permissions, and then click Export.
  8. In the "Microsoft Active Server Pages Output Options" dialog box, type the name of a System DSN on your Web server that points to the Northwind sample database in the Data Source Name box; type the uniform resource locator (URL) for the location on your Web server where you are saving the file in the Server URL box, for example http://<servername>/scripts, and then click OK.
  9. Start Microsoft Internet Explorer 3.0 and type the URL to the Employees (page break).asp file in the Address box. For example:

    http://<servername>/scripts/Employees (page break).asp

    When the form appears, note that the EmployeeName control displays #Expression instead of the full name of the employee.

Modification Type:MinorLast Reviewed:1/26/2005
Keywords:kbinterop kbprb KB165193