Making Microsoft Access Data Available on the Internet

With Microsoft Access, you can make your data available on the Internet or an intranet by:

Saving Data as HTML Documents

Microsoft Access has four ways to save data from your database as HTML documents:

Save data as static HTML documents You can create static HTML documents from table, query, and form datasheets, and from reports. When you save data as static HTML documents, the resulting pages reflect the state of the data at the time it was saved, like a snapshot. If your data changes, you must save the pages again to share the new data.

Save table, query, and form datasheets as IDC/HTX files You can save your table, query, and form datasheets as Internet Database Connector/HTML extension (IDC/HTX) files that generate HTML documents by querying a copy of your database located on a Web server for current data.

Save forms and datasheets as Active Server Pages You can save your forms as Active Server Pages (ASP) that emulate most of the functionality of your forms and display data from a database located on a Web server. You can also save table, query, and form datasheets as Active Server Pages that display current data from a copy of your database located on a Web server.

Automate the publishing of dynamic and static HTML documents You can use the Publish to the Web Wizard to automate the process of saving multiple objects to any combination of all three file types. In the Publish to the Web Wizard, IDC/HTX files and Active Server Pages (ASP) files are collectively referred to as dynamic Web pages because these file types display current data to users.

The following sections discuss each of these options in more detail.

Saving Data as Static HTML Documents

With Microsoft Access 97, you can save table, query, and form datasheets, and reports as static HTML documents.

Û To save a table, query, or form datasheet, or a report as a static HTML document

  1. In the Database window, click the table, query, form, or report you want to save.
  2. On the File menu, click Save As/Export.
  3. In the Save As dialog box, click To An External File Or Database, and then click OK.
  4. In the Save As Type box, click HTML Documents (*.html; *.htm).
  5. If you want to preserve formatting, select the Save Formatted check box. To automatically open the resulting HTML document in your Web browser, select the Autostart check box.
  6. Specify the file name and location to save the file, and then click Export.
  7. In the HTML Output Options dialog box, if you want Microsoft Access to merge an HTML template with the resulting HTML document, specify that as well, and then click OK.

    See Also   For information on HTML templates, see “Using an HTML Template When You Save Data as HTML Documents” later in this chapter.

You can also save data as static HTML documents by using the Publish to the Web Wizard (available through the Save As HTML command on the File menu), the OutputTo method in code, or the OutputTo action in macros.

See Also   For more information on saving table, query, or form datasheets, and reports as HTML documents, search the Help index for “Saving database objects, saving in Internet/Web formats” or “OutputTo method.”

When saving table, query, and form datasheets, Microsoft Access saves each datasheet to a single HTML file. Microsoft Access saves reports as multiple HTML documents, with one HTML file per printed page. To name each page, Microsoft Access uses the name of the object and appends _Pagenn to the end of each page’s file name after the first page; for example, ProductList.htm, ProductList_Page2.htm, ProductList_Page3.htm, and so on.

Saving Table, Query, and Form Datasheets as Static HTML Documents

When you save a table, query, or form datasheet as an HTML document, the HTML document generated is based on the table or query associated with the datasheet, including any sorting or filtering specified by the current setting of the OrderBy or Filter property of the table or query.

If you select the Save Formatted check box, the HTML document contains an HTML table that reflects as closely as possible the appearance of the datasheet by using the appropriate HTML tags to specify color, font, and alignment. The HTML document follows as closely as possible the page orientation and margins of the datasheet. Whenever you want to use settings that are different from the default orientation and margins for a datasheet, you must first open the datasheet, and then use the Page Setup command (File menu) to change settings before you save the datasheet as an HTML document.

If you select the Save Formatted check box, and a field has a Format or InputMask property setting, those settings are reflected in the data in the HTML document. For example, if a field’s Format property is set to Currency, the data in the HTML document is formatted with a dollar sign, a comma as the thousand separator, and two decimal places; for example, $1,123.45.

Saving Reports as Static HTML Documents

When you save a report as HTML documents, the series of HTML documents generated is based on the report’s underlying table or query, including the current OrderBy or Filter property settings of the table or query.

The HTML documents simulate as closely as possible the appearance of the report by creating the appropriate HTML tags to retain attributes such as color, font, and alignment. The proportions and layout of the actual report follow as closely as possible the page orientation and margins set for the report. To change the page orientation and margins, open the report in Print Preview, and then use the Page Setup command to change settings before you save the report as HTML documents. These settings are saved from session to session for reports, so if you change them once, they will be used the next time you save the form or report as HTML documents.

Navigation Controls When Saving Multiple HTML Documents Per Object

If you specify an HTML template that contains placeholders for navigation controls when you save a report as multiple HTML documents, Microsoft Access creates hyperlinks that the user can use to navigate to the first, previous, next, and last pages in the publication. Where Microsoft Access places the hyperlinks depends on where you locate the placeholders in the HTML template.

See Also   For information on HTML templates and placeholders, see “Using an HTML Template When You Save Data as HTML Documents” later in this chapter.

How Microsoft Access Saves Data Types in HTML Format

When you save data as static HTML documents, Microsoft Access saves values from most data types as strings and formats them as closely as possible to their appearance in the datasheet or report. There are two exceptions:

Microsoft Access determines the displaytext, address, and subaddress values by parsing the value stored in the Hyperlink field.

See Also   For information on the displaytext, address, and subaddress values, see “The Hyperlink Field Storage Format” earlier in this chapter.

Using an HTML Template When You Save Data as HTML Documents

When you save data as HTML documents, you can use an HTML template to give a consistent look to the HTML documents you create. For example, you can include your company’s logo, name, and address in the page’s header, use the background that is used throughout your company, or include standard text in the header or footer of the HTML document.

Note   You can use an HTML template when you save data as static HTML documents, when you save datasheets as IDC/HTX files, when you save a form or datasheet as an Active Server Page, and when you use the Publish to the Web Wizard.

The HTML template can be any HTML document; that is, a text file that includes HTML tags and user-specified text and references. In addition, the HTML template can include placeholders that tell Microsoft Access where to insert certain pieces of data in the HTML documents. When data is saved as HTML documents, the placeholders are replaced with data. The following table describes each of the placeholders that you can use in an HTML template.

Placeholder Description Location
<!--AccessTemplate_Title--> The name of the object being saved Between <TITLE> and </TITLE>
<!--AccessTemplate_Body--> The data or object being saved Between <BODY> and </BODY>
<!--AccessTemplate_FirstPage--> An anchor tag to the first page Between <BODY> and </BODY> or after </BODY>
<!--AccessTemplate_PreviousPage--> An anchor tag to the previous page Between <BODY> and </BODY> or after </BODY>
<!--AccessTemplate_NextPage--> An anchor tag to the next page Between <BODY> and </BODY> or after </BODY>
<!--AccessTemplate_LastPage--> An anchor tag to the last page Between <BODY> and </BODY> or after </BODY>
<!--AccessTemplate_PageNumber--> The current page number Between <BODY> and </BODY> or after </BODY>

When you install Microsoft Access, sample HTML template files and graphics files are installed in the Access subfolder of the Templates folder. The default location of this folder is C:\Program Files\Microsoft Office\Office\Templates\Access.

Saving Table, Query, and Form Datasheets as IDC/HTX Files

With Microsoft Access, you can save a table, query, or form datasheet as Internet Database Connector/HTML extension (IDC/HTX) files that generate HTML documents by querying a copy of your database located on a Web server. In contrast to static HTML documents, which contain the data that was current at the time the HTML document was created, IDC/HTX files generate an HTML page with current data from your database; therefore, the HTML documents that they generate are called dynamic.

Û To save a table, query, or form datasheet as IDC/HTX files

  1. In the Database window, click the table, query, or form you want to save.
  2. On the File menu, click Save As/Export.
  3. In the Save As dialog box, click To An External File Or Database, and then click OK.
  4. In the Save As Type box, click Microsoft IIS 1-2 (*.htx/*.idc).
  5. Specify the file name and location to save the files, and then click Export.
  6. In the HTX/IDC Output Options dialog box, specify:
    • The data source name that will be used for a copy of the current database.
    • A user name and password, if required to open the database.
    • An HTML template, if you want Microsoft Access to merge one with the HTML extension (HTX) file.

    Note   You can specify any of these items later, except the HTML template, by editing the resulting IDC file in a text editor such as Notepad.

  7. Click OK.

You can also save a table, query, or form datasheet as IDC/HTX files by using the Publish to the Web Wizard (available through the Save As HTML command on the File menu), the OutputTo method in code, or the OutputTo action in macros.

See Also   For more information on saving table, query, or form datasheets as IDC/HTX files, search the Help index for “Saving database objects, saving in Internet/Web formats” or “OutputTo method.”

How the Internet Database Connector Works

When you save a table, form, or query datasheet as Internet Connector files, Microsoft Access creates two files: an Internet Database Connector (IDC) file and HTML extension (HTX) file. These files are used to generate a Web page that displays current data from your database.

An IDC file contains the necessary information to connect to a specified Open Database Connectivity (ODBC) data source and to run an SQL statement that queries the database. The information needed to connect to the database includes the data source name, and if user-level security is established for the database, the user name and password required to open the database. For example, if you save the Current Product List query datasheet from the Northwind sample application as IDC/HTX files, Microsoft Access creates the following IDC file:

Datasource:Northwind
Template:Current Product List.htx
SQLStatement:SELECT [Product List].ProductID, [Product List].ProductName
+FROM Products AS [Product List]
+WHERE ((([Product List].Discontinued)=No))
+ORDER BY [Product List].ProductName;

Password:
Username:

An IDC file also contains the name and location of an HTML extension (HTX) file. The HTX file is a template for the HTML document; it contains field merge codes that indicate where the values returned by the SQL statement should be inserted. For example, if you save the Current Product List query datasheet from the Northwind sample application as IDC/HTX files, Microsoft Access creates the following HTX file:

<HTML>
<TITLE>Current Product List</TITLE>
<BODY>
<TABLE BORDER=1 BGCOLOR=#ffffff><FONT FACE="Arial" COLOR=#000000>
<CAPTION><B>Current Product List</B></CAPTION>

<THEAD>
<TR>
<TD><FONT SIZE=2 FACE="Arial" COLOR=#000000>Product ID</FONT></TD>
<TD><FONT SIZE=2 FACE="Arial" COLOR=#000000>Product Name</FONT></TD>
</TR>
</THEAD>
<TBODY>
<%BeginDetail%>
<TR VALIGN=TOP>
<TD ALIGN=RIGHT><FONT SIZE=2 FACE="Arial" COLOR=#000000><%ProductID%><BR></FONT></TD>
<TD><FONT SIZE=2 FACE="Arial" COLOR=#000000><%ProductName%><BR></FONT></TD>
</TR>
<%EndDetail%>
</TBODY>
<TFOOT></TFOOT>
</BODY>
</HTML>

Microsoft Access saves the HTX file to be used with an IDC file with the same name as the IDC file, except with an .htx file name extension rather than an .idc file name extension. After the database information has been merged into the HTML document, it is returned to the Web browser.

If you open Current Product List.idc from a Microsoft Internet Information Server that has an appropriately defined Northwind data source name (DSN), the Web page shown in the following illustration is generated.

Note   You can also reference an HTML template when you create IDC and HTX files. An HTML template contains additional HTML code to enhance the appearance of the resulting pages. If you specify an HTML template, it is merged with the HTX file. For information on the format of an HTML template, see “Using an HTML Template When You Save Data as HTML Documents” earlier in this chapter.

Requirements for Using IDC/HTX Files

To use IDC/HTX files, your database and the IDC/HTX files must reside on a computer running one of the following operating systems and Internet server platforms:

  • Microsoft Windows NT Server version 3.51 or 4.0 running Microsoft Internet Information Server version 1.0, 2.0, or 3.0
  • Microsoft Windows NT Workstation version 4.0 and Microsoft Peer Web Services
  • Microsoft Windows 95 and Microsoft Personal Web Server

Microsoft Internet Information Server, Microsoft Peer Web Services, and Personal Web Server use a component called the Internet Database Connector (Httpodbc.dll) to generate Web pages from IDC/HTX files.

The Internet Database Connector component requires ODBC drivers to access a database. To access a Microsoft Access database, the Microsoft Access Desktop driver (Odbcjt32.dll) must be installed on your Web server. This driver is installed when you install Microsoft Internet Information Server if you select the ODBC Drivers And Administration check box during Setup.

However, the Microsoft Access Desktop driver isn’t installed with Personal Web Server. If Microsoft Access is installed on the computer you are using to run Personal Web Server, and if you selected the driver when you installed Microsoft Access, the driver is already available. If you don’t have Microsoft Access installed on the computer you are using to run Personal Web Server, you must install the Microsoft Access Desktop driver.

Û To install the Microsoft Access Desktop driver

  1. Run the Microsoft Office or Microsoft Access Setup program.
  2. If you are running Setup for the first time, click Custom.

    If you are not running Setup for the first time, click Add/Remove.

  3. Select the Data Access Controls check box, and then click Change Option.

    Important The Microsoft Access check box must also be selected or the driver will not be installed.

  4. Select the Database Drivers check box, and then click Change Option.
  5. Select the Microsoft Access Driver check box, and then click OK.
  6. Click Continue, and follow the instructions in the remaining Setup dialog boxes.

After the Microsoft Access Desktop driver is installed, you must create either a system DSN or a file DSN that specifies the name and connection information for each database you want to use on the server. You then specify that DSN when you generate the IDC/HTX files.

See Also   For information on how to define a system DSN or a file DSN, search the Help index for “ODBC, setting up data sources.” For more information on Microsoft Internet Information Server, see the Microsoft Internet Information Server Web site, located at http://www.microsoft.com/infoserv/iisinfo.htm. For more information on using IDC/HTX files, search the Microsoft Internet Information Server Help index for “database connector.”

Tip You can learn more about applications that use IDC/HTX files by reading about the Job Forum application. For information on the Job Forum application, see the Job Forum white paper, located at http://www.microsoft.com/accessdev/accwhite/jobforpa.htm. For applications that require many users to access the database simultaneously, you should consider upsizing the Microsoft Access database back-end server to Microsoft SQL Server. For information about upsizing a Microsoft Access Web application to Microsoft SQL Server, see http://www.microsoft.com/accessdev/accwhite/upsizeweb.htm.

Saving Forms and Datasheets as Active Server Pages

With Microsoft Access, you can save a form as an Active Server Page that emulates much of the functionality of your form. When saving a form as an Active Server Page, Microsoft Access saves most, but not all, controls on the form as ActiveX controls that perform the same or similar functions. Microsoft Access doesn’t save or run Visual Basic code behind the form or controls. To copy the layout of your form as closely as possible, Microsoft Access uses the Microsoft HTML Layout control to position the controls on Active Server Pages. The resulting page uses Visual Basic scripting and a feature of the Active Server Pages components called the Active Database Object (ADO) to connect to a copy of your database on an Internet server.

See Also   For information on the Microsoft HTML Layout control, see http://www.microsoft.com/workshop/author/layout/layout.htm.

Users who open a form saved as an Active Server Page can browse records, update or delete existing records, and add new records.

You can also save table, query, and form datasheets as Active Server Pages. When you open a datasheet saved as an Active Server Page, Microsoft Access displays current data from a copy of your database located on an Internet server, much like IDC/HTX files do. However, unlike IDC/HTX files, Active Server Pages require only one file per datasheet. The ASP file uses Visual Basic scripting to establish a connection to the database on the server, and contains information that it uses to format the datasheet. Unlike a form saved as an Active Server Page, users can’t update existing records in or add new records to a datasheet saved as an Active Server Page.

Û To save a form or datasheet as an Active Server Page

  1. In the Database window, click the form or datasheet you want to save.
  2. On the File menu, click Save As/Export.
  3. In the Save As dialog box, click To An External File Or Database, and then click OK.
  4. In the Save As Type box, click Microsoft Active Server Pages(*.asp).
  5. Specify the file name and location to save the file, and then click Export.
  6. In the Microsoft Active Server Pages Output Options dialog box, specify:
    • The data source name that will be used for a copy of the current database.
    • A user name and password, if required to open the database.
    • An HTML template, if you want Microsoft Access to merge one with the Active Server Page.

      See Also   For information on HTML templates, see “Using an HTML Template When You Save Data as HTML Documents” earlier in this chapter.

    • The URL for the server where the Active Server Page will reside.
    • The Session Timeout setting, which determines how long a connection to the server is maintained after the user stops working with the Active Server Page.
  7. Click OK.

You can also save forms and datasheets as Active Server Pages by using the Publish to the Web Wizard (available through the Save As HTML command on the File menu), the OutputTo method in code, or the OutputTo action in macros.

See Also   For more information on saving forms and datasheets as Active Server Pages, search the Help index for “saving database objects, saving in Internet/Web formats” or “OutputTo method.”

Form Views Supported for Active Server Pages

If the form you save as an Active Server Page has its DefaultView property set to Single Form or Continuous Forms, the Active Server Page displays as a single form, unless it is open in Datasheet view when you use the Save As/Export command (File menu). If the form has its DefaultView property set to Datasheet, the Active Server Page displays as a datasheet. Subforms always display as datasheets, regardless of their DefaultView property setting. All field data types are saved unformatted, that is, Format and InputMask property settings aren’t saved.

Control Types Supported for Active Server Pages

When Microsoft Access saves a form as an Active Server Page, it replaces Microsoft Access controls with ActiveX controls, as described in the following table.

Microsoft Access control ActiveX control
Text box Text box.
Text box control bound to a Hyperlink field Text box that displays the hyperlink text, but the hyperlink can’t be followed.
List box List box.
Combo box Combo box.
Label Label. If the label has HyperlinkAddress and/or HyperlinkSubAddress properties set, a hyperlink is created for the label.
Command button Command button, but any code behind the button isn’t saved. If the command button has HyperlinkAddress and/or HyperlinkSubAddress properties set, a hyperlink is created for the button.
Option group Option group, but without a group frame.
Option button Option button.
Check box Check box.
Toggle button Toggle button.
ActiveX control ActiveX control, but any code behind the control isn’t saved.
Subform Subform as datasheet only.

Microsoft Access doesn’t support the following controls when saving a form as an Active Server Page:

  • Tab controls, and anything on tab controls
  • Rectangles
  • Lines
  • Page breaks
  • Unbound object frames
  • Bound object frames
  • Image controls
  • The background of a form set with the Picture property

Note   You can simulate a rectangle or a line by using a label control without a caption.

Requirements for Using Active Server Pages

To display and use an Active Server Page, a copy of your database and Active Server Pages must reside on a computer running one of the following operating systems and Internet server platforms:

  • Microsoft Windows NT Server version 3.51 or 4.0 running Microsoft Internet Information Server version 3.0
  • Microsoft Windows NT Workstation version 4.0 and Microsoft Peer Web Services with the Active Server Pages components installed
  • Microsoft Windows 95 and Microsoft Personal Web Server with the Active Server Pages components installed

The Microsoft HTML Layout control must be installed on the computer opening the Active Server Page. The Active Server Pages components used to display Active Server Pages are available when installing Microsoft Internet Information Server version 3.0. To use Active Server Pages with Microsoft Peer Web Services or Microsoft Personal Web Server, you must install the Active Server Pages components as a separate add-in. Active Server Pages also require the Microsoft Access Desktop driver and a valid DSN to access a database.

See Also   For more information on installing Microsoft Peer Web Services or Microsoft Personal Web Server see “Setting Up a Personal Web Server” later in this chapter. For information on installing the Microsoft Access Desktop driver and defining DSNs, see “Requirements for Using IDC/HTX Files” earlier in this chapter.

See Also   For information on installing the Microsoft Access Desktop driver and defining DSNs, see “Requirements for Using IDC/HTX Files” earlier in this chapter.

Using the Publish to the Web Wizard

With the Publish to the Web Wizard, you can publish a set of Microsoft Access database objects to any combination of static HTML documents, IDC/HTX files, or Active Server Pages (ASP). Using the wizard, you can:

  • Pick any combination of tables, queries, forms, or reports to save.
  • Specify an HTML template to use for the selected objects.
  • Select any combination of static HTML documents, IDC/HTX files, or Active Server Pages (ASP).
  • Create a home page to tie together the Web pages you create.
  • Specify the folder where you save your files.
  • Use the Web Publishing Wizard to move the files created by the Publish to the Web Wizard to a Web server.
  • Save the answers you provide the wizard as a Web publication profile, and then select that profile the next time you use the wizard. This saves you from having to answer the wizard’s questions again.

To run the Publish to the Web Wizard, click Save As HTML on the File menu.

See Also   For more information on using the Publish to the Web Wizard, search the Help index for “Saving database objects, saving in Internet/Web formats.”

Synchronizing Database Replicas over the Internet

With Microsoft Access 97, you can synchronize replicas over the Internet. Before you can synchronize over the Internet, you must configure your Internet server for replication. To configure your Internet server, you need Replication Manager, which includes a wizard that takes you through the configuration process.

See Also   For more information on Replication Manager, see “Replication Manager” in Chapter 20, “Using Replication in Your Application.”