Using Microsoft Access, you can create different types of Web pages. To manipulate the data directly in your database, use a data access page; to see up-to-date, read-only data, consider server-generated ASP (Active Server Page (ASP): A file that contains embedded server-side scripting that is executed on a server and sent to and displayed in a client Web browser as a standard HTML file.) or IDC/HTX (IDC/HTX files: Microsoft Internet Information Server uses an IDC file and an HTX file to retrieve data from an ODBC data source and format it as an HTML document.) files; to see a snapshot of your data, use a static HTML (HTML: The standard markup language used for documents on the World Wide Web. HTML uses tags to indicate how Web browsers should display page elements such as text and graphics and how to respond to user actions.) file format. To make sure that the appearance of your Web pages is consistent, you can use HTML template files.
Data access pages
A data access page is a Web page that is connected directly to the data in your database. Use these pages to view, edit, update, delete, filter, group, and sort live data from either an Access database or a Microsoft SQL Server database (Microsoft SQL Server database: A database that consists of tables, views, indexes, stored procedures, functions, and triggers. You can connect your database to SQL Server data by using ODBC or by creating an Access project (*.adp) file.), in Microsoft Internet Explorer 5.01 with Service Pack 2 (SP2) or later. A page can also contain components such as a spreadsheet (Spreadsheet Component: A Microsoft Office Web Component that provides the interactive functionality of a spreadsheet on a Web page.You can enter data, add formulas and functions, apply filters, change formatting, and recalculate.), a PivotTable list (PivotTable list: A Microsoft Office Web Component that is used to analyze data interactively on a Web page. Data displayed in a row and column format can be moved, filtered, sorted, and calculated in ways that are meaningful for your audience.), or a chart (chart: A graphical representation of data in a form, report, or data access page.).
You create a data access page as a database object (database objects: An Access database contains objects such as tables, queries, forms, reports, pages, macros, and modules. An Access project contains objects such as forms, reports, pages, macros, and modules.) that contains a shortcut to the location of the page's corresponding HTML file.
Data access pages can also be saved as HTML Application (HTA) files. HTA files allow you to use Dynamic HTML (DHTML (DHTML: An extension of Hypertext Markup Language (HTML) that adds multimedia, database access, and an object model that programs can use to change styles and attributes of page elements (objects) and to replace existing elements (objects) with new ones.)) technology "out of the browser" to write stand-alone applications. With HTA, you can write an application the same way you write a Web page with DHTML and script, or you can take content originally authored for the Web and turn it into an application. "Out of the browser" means that HTAs differ from Web pages in two important ways:
- Your application is written completely in DHTML but runs in its own window without the browser menus and toolbars. This means your application fully defines the user interface.
- Your application is fully trusted and free from the restrictions placed on Web pages for security reasons. Unlike Web pages, which run when visited, users will need to trust your HTA; however, once installed and run, your HTA can potentially do anything any program can.
For more information about HTA files, see the following article on the MSDN Web site:
Making your data access pages available
To make your pages available on the World Wide Web (World Wide Web (WWW): The multimedia branch of the Internet that presents not only text, but also graphics, sound, and video. On the Web, users can easily jump from item to item, page to page, or site to site by using hyperlinks.), you publish the pages to Web folders (Web folder: A shortcut you use to save, open, copy, or delete files on a Web or FTP server. Some Web folders, such as document libraries, have functionality not available with local folders. You'll find Web folders in My Network Places or Web Folders.) or to a Web server. You must also make the Access database or SQL Server database available to users of the page.
Internet Explorer needs to download the page only once from the Web server to let you view and interact with the data on the page. Because a page uses DHTML, access to the database is generally very efficient in a client/server environment.
The Access or SQL Server database that is the OLE DB (OLE DB: A component database architecture that provides efficient network and Internet access to many types of data sources, including relational data, mail files, flat files, and spreadsheets.) data source for a data access page must be on a shared server or computer in order for users to view and interact with the page in a Web browser or in a mail message.
It's a good idea to place the database on a shared server or computer before you create your page. If you move the database that the page is connected to after you create the page, you must change the OLE DB data source connection of the page in the Connection dialog box of the data access page.
Although the data source of a page can only be an Access or SQL Server database, you can make other data formats accessible from a page by using linked tables from an Access database.
To further help protect your data access pages, you must put the Access or SQL Server database on the same Web server as the data access page.
Important Make sure you use a universal naming convention (UNC (universal naming convention (UNC): A naming convention for files that provides a machine-independent means of locating the file. Rather than specifying a drive letter and path, a UNC name uses the syntax \\server\share\path\filename.)) path, instead of relying on the drive letter of a mapped network drive in Windows Explorer when you are setting up the data source to the page. A drive letter can vary on a computer or may not always be defined, whereas a UNC path is a reliable and consistent way for the page to locate the data source.
Supporting files and Web links
When you create a data access page, Access manages the related files and plans the links and hyperlinks so that the images appear and the links work when the pages are placed on the final Web server.
When you save your file as a data access page in Design view (Design view: A view that shows the design of these database objects: tables, queries, forms, reports, and macros. In Design view, you can create new database objects and modify the design of existing objects.), all supporting files — such as bullets, background textures, and graphics — are by default organized in a supporting folder. If you move or copy your data access page to another location, you must also move the supporting folder so that you maintain all links to your page.
For example, suppose you have a page called Page1.htm. It includes bullets, which are stored in a supporting folder called Page1_files. If you move Page1.htm, you must also move the supporting folder (Page1_files) to the new location.
By default, the name of the supporting folder is the name of the data access page plus an underscore (_), a period (.), or a hyphen (-), and the word "files." The word "files" will appear in the language of the version of Microsoft Office used to save the file as a data access page. For example, if you use the Dutch language version of Office to save a file called Page1 as a data access page, the default name of the supporting folder would be Page1_bestanden.
After you have published your data access page to the Internet (Internet: A worldwide network of thousands of smaller computer networks and millions of commercial, educational, government, and personal computers. The Internet is like an electronic city with virtual libraries, stores, art galleries, and so on.) or an intranet (intranet: A network within an organization that uses Internet technologies (such as the HTTP or FTP protocol). By using hyperlinks, you can explore objects, documents, pages, and other destinations on the intranet.), you should test it in a Web browser. Make sure that all the graphics are displayed and that hyperlinks go to the correct destinations.
Dynamic (server-generated) HTML
You can create dynamic (server-generated) HTML files, either ASP or IDC/HTX, from tables, queries, and forms. Server-generated HTML files are displayed in a table format in a Web browser. Use server-generated HTML files when you want to use any Web browser. Server-generated HTML files are also useful if you need to see live data in a table connected to an ODBC data source (ODBC data source: Data and the information needed to access that data from programs and databases that support the Open Database Connectivity (ODBC) protocol.), but you only need read-only access to the data.
Once you have output a datasheet to ASP or IDC/HTX format, you need to publish the files to make them available on the World Wide Web.
Each time a user opens or refreshes an ASP or HTX file from a Web browser, the Web server dynamically creates an HTML file, and then sends that HTML file to the Web browser.
If you create a server-generated HTML file from a datasheet that contains a parameter query (parameter query: A query in which a user interactively specifies one or more criteria values. A parameter query is not a separate kind of query; rather, it extends the flexibility of a query.), Access simulates the Enter Parameter Value dialog box by creating an additional HTML parameter page that contains an HTML form text box control for entering the parameter value, and a button for running the query. You must explicitly define the parameter data types when you create the parameter query. You must also display this HTML parameter Web page before you display the datasheet Web page. During the export operation, Microsoft Access executes the query and displays the Enter Parameter Value dialog box, but you can just click OK because the input is ignored.
Table or datasheet fields with a Hyperlink data type are output in HTML files as strings by using the following hyperlink address format: displaytext#address#subaddress#screentip. Although you cannot click the string in a Web browser to follow the hyperlink address, you can copy and paste the address portion into the address bar of the Web browser.
Differences between ASP files and IDC/HTX files
You can save table, query, or form datasheets as IDC/HTX files that generate HTML documents by querying your database for current data.
You can save forms as ASP files that emulate most of the functionality of the original form and display data from your database on a Web server. Most of the controls on your form are saved as ActiveX (ActiveX: A set of technologies that enables software components to interact with one another in a networked environment, regardless of the language in which the components were created.) controls that perform the same or similar functions. None of the Visual Basic code behind your forms or controls is saved or run when the ASP file is created or activated. You can also save tables, queries, and form datasheets as ASP files that display the current data from your database.
How your Web server processes IDC/HTX files
When you output a table, query, or form as IDC/HTX files, instead of as an .html file, Access creates an HTML extension file (.htx). and an Internet Database Connector file (.idc). Internet Database Connector (httpodbc.dll) is a component of Microsoft Internet Information Services (IIS).
The .idc file contains a query in the form of an SQL statement and information that IIS uses to connect to an ODBC data source such as an Access or SQL Server database. The connection information includes the data source name and often a user name and password.
The .htx file is an HTML file that contains formatting information and placeholders indicating where to insert the values returned from the query in the .idc file.
After you publish your IDC/HTX files to a Web server, IIS can open the database (by using the appropriate ODBC driver and the .idc file connection information), run the query in the .idc file to access the data, merge the results and the .htx file into one .html file, and send the dynamically created .html file to the Web browser as a Web page.
How your Web server processes ASP files
On the other hand, when you output a table, query, or form as an ASP file, instead of as an .html file, Access creates a Microsoft Active Server Page (.asp) file. Active Server is a component of Microsoft Internet Information Server 3.0 or later.
The .asp file contains HTML tags interspersed with one or more queries in the form of SQL statements, template directives, and Microsoft Visual Basic Scripting Edition (VBScript) code containing references to ActiveX server controls. The .asp file also contains ODBC connection information to connect to an ODBC data source; in this case, an Access or SQL Server database. The connection information includes the data source name and often a user name and password.
After you publish your ASP files to a Web server, IIS can run the VBScript code, call the ActiveX server controls, open the database (by using the appropriate ODBC driver and the .asp file connection information), run the queries in the .asp file to access the data, merge the results and HTML tags in the .asp file into one .html file, and then send the dynamically created .html file to the Web browser as a Web page.
You can create static HTML files from tables, queries, forms, and reports. In a Web browser, reports are displayed in a report format. Tables, queries, and forms are displayed in a datasheet format. Use static HTML files when you want to use any Web browser that supports HTML version 3.2 or later and if your data does not change frequently.
To make your static HTML files available on the World Wide Web, you publish the files to Web folders or a Web server.
When you access the data through a Web browser, the browser needs to download the static HTML file only once from the Web server to let you view the data. There is no ODBC data source (ODBC data source: Data and the information needed to access that data from programs and databases that support the Open Database Connectivity (ODBC) protocol.) connected to the static HTML file, and if your data changes, you must export your files again to be able to view new data in a Web browser.
HTML template files
You can use one or more HTML template files to enhance the appearance, consistency, and navigation of your static HTML and server-generated HTML files. For example, you might want to include a company logo in the header (report header: A report section that is used to place information (such as a title, date, or report introduction) at the beginning of a report.) section and your own navigation buttons in the footer (report footer: A report section that is used to place information that normally appears at the bottom of the page, such as page numbers, dates, and sums.) section of a static HTML report.
An HTML template is a text file that includes HTML tags and tokens that are unique to Access. These tokens indicate where to insert output and other information in the static HTML or server-generated HTML files.
When you output a table, query, form, or report using the Export command on the File menu and you specify an HTML template file in the Output Options dialog box, Access merges the HTML template file with the .html, .asp, and .htx output files by replacing the tokens (such as <!--AccessTemplate_Title-->) with the following:
Becomes the name of the table, query, form, or report placed in the title bar of the Web browser
The output of the table, query, form, or report
An HTML anchor tag that links to the first page of a report
An HTML anchor tag that links to the page previous to the current report page
An HTML anchor tag that links to the next page after the current report page
An HTML anchor tag that links to the last page of a report
The current page number
HTML template file example
<!--The following token places the object name in the title bar of the Web browser.-->
<!--The following HTML tag creates a different background color than the Web browser default.-->
<BODY BACKGROUND = "gray.jpg">
<!--The following token places all object output inside the <BODY> tag.-->
<!--The following four tokens create four navigation text buttons that jump to the first, previous, next, and last pages of a report.-->
<A HREF = "<!--AccessTemplate_FirstPage-->">First</A>
<A HREF = "<!--AccessTemplate_PreviousPage-->">Previous</A>
<A HREF = "<!--AccessTemplate_NextPage-->">Next</A>
<A HREF = "<!--AccessTemplate_LastPage-->">Last</A>
<!--The following token inserts the text "Page n" , where n is the current report page number.-->
<P ALIGN = CENTER>Page <!--AccessTemplate_PageNumber-->.</P>
<!--The following HTML tag adds a company logo to the bottom of the Web page.-->
<IMG SRC = "company_logo.jpg">