Transcript Chapter 1

1

Chapter 12 Working With Access 2000 on the Internet

12

Chapter Objectives

• • • • Review hyperlinks, HTML, and cascading style sheets Learn about data access pages Explore server-side sorting and filtering Learn about scripts and Active Server Pages

12

Working With Access 2000 on the Internet

• Two ways exist to link to Access 2000 database to a Web application:  Use the Data Access Page (DAP) object that exists in Access 2000  Use Active Server Pages (ASP) technology

12

Hyperlinks

• Hyperlink field  Contains the specification for a universal resource locator (URL)  Created in a table simply by choosing the hyperlink data type as the field format for the attribute when you are designing the table

12

Hyperlinks

• Two properties that can be manipulated:  Hyperlink Address  Specifies the URL  May designate a specific file on a local network or a local hard drive  Hyperlink SubAddress  May specifies a specific form within the database

12

HTML

• Hypertext Markup Language (HTML)  Not a programming language, but a formatting language  Access 2000 permits tables, forms, reports, and queries to be saved in an HTML format  Static file  When working with forms, only a form’s Datasheet view can be saved as HTML

12

Cascading Style Sheets

• Cascading style sheets (CSS)   Make it easier to change page formats Contains the definition of various format properties  Can be used to format Web pages  If a change is made in the CSS, then all of the Web pages using it will reflect the change

12

Working With Data Access Pages

• • Data access pages  External files that provide a means to use Access 2000 on the Internet  Stored as separate HTML files To preview a page as it would appear in a browser, right-click the shortcut in the Database window and choose Web Page Preview

12

Working With Data Access Pages

• You can change the appearance of a data access page:  Themes  Formatting templates   Add text, labels, and controls Add a picture or other image file as data in an OLE Object field

12

Data Access Page Properties

• To view a data access page’s properties, click the title bar of the data access page after opening the Properties window

Figure 12-1

Property sheet for a data access page

12

Data Access Page Properties

• Properties of a data access page:  DataEntry  Controls whether new records can be added to the underlying table  MaxRecords  Allows you to designate the number of records sent to a client computer from a server  RecordType  Determines whether a recordset is updateable

12

The Record Navigation Control

• Record navigation control   Unique to data access pages Provides the capability to perform many tasks involving record navigation, record creation and deletion, and record sorting

12

The Record Navigation Control

Figure 12-2

Record navigation control instance

12

Grouping Data in Data Access Pages

• Grouping data on a data access page is similar to grouping data on a report with a sub-report except:  Data displayed is dynamic   Data access pages are interactive Data access pages that display grouped data are read-only

12

Grouping Data in Data Access Pages

• Group properties:  Expanded by Default  When set to Yes, the data access page automatically displays the data within a grouping  Data Page Size  Settings determines the maximum number of records to display within a particular grouping level

12

Grouping Data in Data Access Pages Figure 12-3

Expand control instance on a grouped data access page

12

Server-Side Sorting and Filtering

• • • Server-side sorting and filtering can save time when downloading data to the client Establish a default server-side sort order by setting the Default Sort property in the Sorting and Grouping dialog box When Access publishes a page as an Active Server Page, a server filter can be applied to perform the filtering operation on the server  Only the filtered data are downloaded

12

Scripts and Access 2000

• You can associate VBA program code with events to customize an application in an Internet environment  VBScript is a variation of VBA that works with Internet Explorer 5  Does not recognize VBA

12

Scripts and Access 2000

• VBScript differs from VBA in several ways:   All variables in VBScript are variants Arguments passed to procedures and functions cannot be typed  Many functions found in VBA are not available in VBScript

12

Scripts and Access 2000

• VBScript differs from VBA in several ways:  Error-handling capabilities are not as sophisticated in VBScript  Symbolic constants are not predefined  To use them, you must create a file and include it yourself

12

Scripts and Access 2000

• • Certain data access page events are not recognized when coded in JavaScript and script elements are case-sensitive in JavaScript You can add scripts by choosing Tools, Macros, and the Microsoft Script Editor from the menu bar  Displays the Microsoft Development Environment window

12

Scripts and Access 2000

Figure 12-5

Microsoft Development Environment window

12

Scripts and Access 2000

• When you connect an Active Server Page to an Access 2000 database  Include a file, named

adovbs.inc

, that contains predefined symbolic constants to facilitate establishing the database connection

12

Active Server Pages and Access 2000

• Active Server Pages (ASP)  Implemented as an Internet Server application programming interface (ISAPI) filter running under Microsoft’s Internet Information Server (IIS)

12

Scripts and Access 2000

• Whenever a Web client sends an HTTP request to a Web server:  The Active Server ISAPI filter has a chance to intercept and interpret the request • If the request involves an ASP file:  The filter parses the entire file and returns HTML output to IIS  IIS then returns these data to the client

12

Scripts and Access 2000

• To implement ASP, you must have a Web server configured to support the technology • System data source   Data source that is accessible to all user ODBC 32 control panel on the server is used to establish an Access database such as a system data source

12

Using the Global.asa File

• Global.asa file performs two functions:  Indicates where the scripts will be executed  In many cases, it takes place on the server to take advantage of the processing power typically available there  Amount of data transferred to the client can be minimized

12

Using the Global.asa File

• • Global.asa file performs two functions (continued):  Implements scripts associated with four specific events  Events that occur for the Application and Sessions objects Application object   Created when the application runs Responds to the OnStart and an OnEnd event

12

Using the Global.asa File

• Session object  Separate object is created for each user of the application  Responds to its own OnStart and OnEnd events

12

Variables and the OnStart Event

• • OnStart event of the Application object  Used to initialize or update variables used by the application Variables may include the number of users of the application or the number of users who have visited the Web site since the application started

12

Variables and the OnStart Event

• OnStart event for the Session object  Initializes variables for a particular user’s session  Timeout variable  Indicates how long a session is allowed to be idle before it is automatically terminated by the server

12

Session Variables in ASP

• Session variable  Can declare any number of Session variables simply by using them  Available to all ASP files that execute during the session  Acts like a global variable in other programming languages

12

The OnEnd Event

• • OnEnd event for the Application object  Occurs when the application ends OnEnd event for the Sessions object   Occurs when the session ends Used to update persistent data relevant to the application

12

Chapter Summary

• Access 2000 provides several ways to create Web-enabled database applications  Hyperlink data type  Fundamental Web-enabling object  New capabilities with the Access development environment for developing Web-enabled applications

12

Chapter Summary

• • DAP objects  Not totally contained in the .mdb file associated with an Access application Data access page  Web page that must be accessible by a server  Web pages must be saved as an HTML file outside the .mdb file

12

Chapter Summary

• Data access pages (continued)  Created in much the same manner as forms or reports  Same toolbox is used for their creation  Contains additional, Web-specific tools for operations such as creating a bound HTML control

12

Chapter Summary

• • VBScript  Variation of VBA Active Server Pages  Provides an environment in which VBScript and embedded SQL commands can be used to access data in Access databases and to create Web pages dynamically