Online Book Reader

Home Category

Access Cookbook - Ken Getz [337]

By Root 1840 0
more VBScript code that has been generated to handle reporting engine features such as evaluating expressions, running sums, sorting and grouping and so on. The code is commented, so you can examine it and see what it's doing.

Dissecting the ASP


When you choose to output the XML to ASP, the page is intended to run on the server, and different code is generated. If you attempt to load the ASP page from the file system, you will get an error.

If you open CustomerPreferencesASP.asp in Notepad or another text editor, you will see the following code which invokes the .xml and .xsl files:

<%

Set objData = CreateDOM

objData.async = false

if (false) then

Set objDataXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")

objDataXMLHTTP.open "GET", "", false

objDataXMLHTTP.setRequestHeader "Content-Type", "text/xml"

objDataXMLHTTP.send

objData.load(objDataXMLHTTP.responseBody)

else

objData.load(Server.MapPath("CustomerPreferencesASP.xml"))

end if

Set objStyle = CreateDOM

objStyle.async = false

objStyle.load(Server.MapPath("CustomerPreferencesASP.xsl"))

Session.CodePage = 65001

Response.ContentType = "text/html"

Response.Write objData.transformNode(objStyle)

Function CreateDOM( )

On Error Resume Next

Dim tmpDOM

Set tmpDOM = Nothing

Set tmpDOM = Server.CreateObject("MSXML2.DOMDocument.5.0")

If tmpDOM Is Nothing Then

Set tmpDOM = Server.CreateObject("MSXML2.DOMDocument.4.0")

End If

If tmpDOM Is Nothing Then

Set tmpDOM = Server.CreateObject("MSXML.DOMDocument")

End If

Set CreateDOM = tmpDOM

End Function

%>

The CustomerPreferencesASP.xsl file is structured similarly to the CustomerPreferencesHTM.xsl file, with formatting instructions for how the report is to be rendered at the bottom of the page.

These built-in export capabilities for Access reports show that outputting the data as XML and formatting it using XSLT is a powerful approach. With the proper XSLT transformations, your Access reports can be exported to any text-based document format.

See Also


The \Program Files\Microsoft Office\OFFICE11\AccessWeb directory, which is created when you install Access, contains additional transforms to assist you in creating your own XSL stylesheet. See Rpt2HTM4.xsl, used to transform Access reports into ReportML, which describes the presentation-specific attributes of a report. The Rpt2DAP.xsl transform also found in the folder can be used to transform ReportML into a data access page (DAP).

Index


A NOTE ON THE DIGITAL INDEX

A link in an index entry is displayed as the section title in which that entry appears. Because some sections have multiple index markers, it is not unusual for an entry to have several links to the same section. Clicking on any link will take you directly to the place in the text in which the marker appears.

Symbols

" (quotes), Discussion

combo boxes and, Discussion

# (number sign), Discussion, Discussion

#Error message, Problem

& (ampersand), Discussion

' (apostrophe), Discussion, Discussion

( ) (parentheses), Solution

* (asterisk), Discussion

+ (plus sign), Discussion, Discussion

.NET, .NET, See Also, Problem, See Also

DataSet, Problem, See Also

.NET component, An alternate solution

calling in Access, An alternate solution

Visual Basic .NET only solution, An alternate solution

.NET components, Problem, See Also, Solution, Solution, Not all .NET components are callable, Problem, Discussion

calling from COM programs, Solution

calling in Access, Problem, See Also

containing parameterized constructors, Problem, Discussion

creating simple, Solution

restrictions, Not all .NET components are callable

.NET Framework 1.1, .NET

.NET SDK, Solution

/ (slash) operator, Solution

/wrkgrp switch, Work with the secured database

; (semicolon), Discussion, Discussion, Solution

multiple columns and, Discussion

RecordsetLabel property and, Solution

SQL statements and, Discussion

>= (greater than or equal to) operator, Discussion

? (question mark), Solution

[ ] (square brackets), Solution, Discussion, Discussion, Solution,

Return Main Page Previous Page Next Page

®Online Book Reader