📄 ch07.htm
字号:
data (See also "Print Preview: Layout.") From the preview window, you can
merge data with Word, publish to a Word document, or analyze data with Excel. These
three options are available as toolbar buttons.
<H2><FONT COLOR="#000077"><B>Print Preview: Layout</B></FONT></H2>
<P>Access 97 offers you two different types of previews: Print Preview and Layout
Preview. In the former instance, you see everything that will print to your printer,
each page and all of the data contained therein. For long print jobs, it can take
a while for your computer to process this information. If you want to view a small
<I>group</I> of your records in preview, you can see an example layout in the Layout
Preview mode. In this mode, you see just enough data to get a feeling for all of
the <I>sections</I> of a <I>report</I>.
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1.</B> With your report in <I>Design View</I>, click the View button on the
toolbar. <BR>
<BR>
<B>2.</B> Select the La_yout Preview command.
</DL>
<BLOCKQUOTE>
<P>
<HR>
<FONT COLOR="#000077"><B>CAUTION:</B></FONT> Layout Preview can be misleading because
you don't get a view of all of your data. If you are using a <I>query </I>that contains
<I>para-meters</I>, for example, Layout Preview will not detect this and show you
a truly representative data set. For reports that don't take a long time to process,
you are better off using the Print Preview view to see your reports.
<HR>
</BLOCKQUOTE>
<H2><FONT COLOR="#000077"><B>Print Reports</B></FONT></H2>
<P>Reports are the best way to get data outputted to a printer. Although you can
print tables, queries, and forms, none of the other objects offer the formatting
and printing options that reports do. For example, only in reports can you get grouped
data with subtotals and the detail data as well. (See "Reports: Grouping"
in the Forms and Reports part in this book.) You can also print reports from various
locations.
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1.</B> If you are in the <I>Database window</I>, right-click the report name
and choose <U>P</U>rint. <B><BR>
<BR>
2.</B> To select specific pages, choose the number of copies, make your choices on
the Print <I>dialog box</I>, and choose OK.
</DL>
<BLOCKQUOTE>
<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> To print a report without specifying print
options, in Report <I>Design View</I> or Print Preview, you can click the Print button
on the toolbar.
<HR>
</BLOCKQUOTE>
<P>If you want to interrupt printing and you are fast, click the Cancel button that
appears in the Printing dialog box. You also might be able to double-click the Printer
icon in the taskbar and cancel the print job by choosing <U>D</U>ocument, <U>C</U>ancel
Printing in the Printer window.
<H2><FONT COLOR="#000077"><B>Print Selected Pages</B></FONT></H2>
<P>You can print multiple pages of a <I>report</I> or <I>form</I>. On a form or columnar
report, if you want to print different records, add a page break at the bottom of
<I>Design View.</I> (See "Page Break: Insert on Report.") Then the page
numbers correspond to the <I>record</I> numbers. An alternative is to go to each
record you want to print in <I>Form View</I> and print that record. (See "Print
One Record From Form.")
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1.</B> Open a form or report in Design View. <BR>
<BR>
<B>2.</B> Choose <U>F</U>ile, <U>P</U>rint. <BR>
<BR>
<B>3.</B> In the Pages area, type the first page in <U>F</U>rom and the last page
in <U>T</U>o; choose OK.
</DL>
<H2><FONT COLOR="#000077"><B>Print Table or Query</B></FONT></H2>
<P>Instead of printing a report, you can print the <I>Datasheet View</I> of a <I>table</I>
or <I>query</I> for quick results. Although you have little control over the formatting
(see "Datasheet: Appearance Change" in the Table and Database Design part
of this book), all you might need is the <I>grid</I> produced from Datasheet View.
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1.</B> Open the table or query in Datasheet View. <B><BR>
<BR>
2.</B> Click the Print button.
</DL>
<BLOCKQUOTE>
<P>
<HR>
<FONT COLOR="#000077"><B>TIP:</B></FONT> You can also print from the <I>Database
window</I>. Right-click a table or query and choose <U>P</U>rint.
<HR>
</P>
<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> Access automatically adds a header with
the table or query name centered, the date right justified, and the page number centered
in a footer. If you don't want to print the header and footer, choose <U>F</U>ile,
Page Set<U>u</U>p; click the Margins tab; and uncheck the Print Headings <I>check
box</I>. Then follow the steps to print your table or query. You cannot edit the
header and footer on a table or query.
<HR>
</BLOCKQUOTE>
<H2><FONT COLOR="#000077"><B>Printing: Multiple Copies</B></FONT></H2>
<P>Before you begin printing your document, you can specify how many copies you want
to print. If you want to print multiple copies of a multi-page document, be sure
to preview before you print.</P>
<P>You also can choose whether or not to collate the documents as they are printed.
Normally, you will want to choose the C<U>o</U>llate option, which prints all pages
of a document before it prints the document again.</P>
<P>(See "Print Preview" before you complete this task.)
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1.</B> Choose <U>F</U>ile, <U>P</U>rint. <BR>
<BR>
<B>2.</B> Type the number of copies you want to print in the Number of <U>C</U>opies
<I>text box</I>. <B><BR>
<BR>
3.</B> Be sure that the C<U>o</U>llate <I>check box</I> is selected; or, if you don't
want your printouts to collate, deselect the C<U>o</U>llate check box. Click OK to
begin printing.
</DL>
<H2><FONT COLOR="#000077"><B>Programming Events: Print</B></FONT></H2>
<P>You can <I>control</I> printing to a fine degree by adding programming to the
print events for a report. You add programming to print or not print certain <I>sections</I>
or controls on your report, depending on choices you make on <I>dialog boxes</I>
or the underlying values of the data.</P>
<P>One of the report print events is On No Data. If the report doesn't have any data
to print, there is no sense printing a blank report. The following steps show you
how to display a dialog box and cancel the printing (or previewing) of a report.
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1.</B> Open the report in <I>Design View</I> and double-click the <I>Form</I>/Report
Selector to open up the <I>Property</I> sheet. <B><BR>
<BR>
2.</B> Scroll down to the On No Data property (on the Event tab), click the build
(...) button, and double-click Code Builder in the Choose Builder dialog box. The
insertion point is between a <TT>Sub</TT> and <TT>End Sub</TT> statement. <BR>
<BR>
<B>3.</B> Type <B>MsgBox "No data for report. Report will not print." </B>and
press Enter. This will display a message for the user. You can type any text you
want within the quotes. <BR>
<BR>
<B>4.</B> Type <B>Cancel </B>=<B> True</B>. If you look at the first line of your
code, you will see (<TT>Cancel as Integer</TT>). The procedure is looking for a <I>variable</I>
called Cancel; this statement is telling Access to not print the report. <B><BR>
<BR>
5.</B> Close the window and try testing the procedure. This works best if you have
a <I>query</I> underlying the report and you go to the query and add some criteria
that wouldn't return any records.
</DL>
<P>The other print event associated with the report is On Page which will trigger
before the page is printed but after the Format events for report sections. The Report
and <I>Group</I> Header and Footer and Detail sections also have print events. To
see help on the events, open a Property sheet, click the Events tab, select one of
these sections, and move to one of the properties (On Format, On Print, or On Retreat).
Then press F1.
<BLOCKQUOTE>
<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> For an example of the On Format property
in the sample Northwind database, open the Sales by Year report and look at the On
Format property for the Detail section. The programming includes <BR>
<TT>If Forms![Sales by Year Dialog]!ShowDetails = False Then Cancel = True</TT><BR>
When you open this report in Print Preview or attempt to print it, a form (Sales
by Year Dialog) opens with a check box named ShowDetails. If the user unchecks the
ShowDetails box, the detail section will not print.
<HR>
</BLOCKQUOTE>
<H2><FONT COLOR="#000077"><B>Web Page: Publish</B></FONT></H2>
<P>Some people will begin their foray into <I>database</I> publishing to the Web
by visiting the new Web Publishing Wizard. This wizard guides you through the process
of Web page and site creation. You start the Web Publishing Wizard by selecting the
Save As <CITE>H</CITE><I>TML</I> command from the <U>F</U>ile menu. The Web Publishing
Wizard can output datasheets, forms, and reports as static or dynamic Web documents
using template files. It can create a home page that has links to your other documents.
You can use the Web Publishing Wizard to copy the files and folder created to your
Web server.
<BLOCKQUOTE>
<P>
<HR>
<FONT COLOR="#000077"><B>TIP:</B></FONT> Microsoft Office contains a Web Fast Find
Search page that you can use to search for files on an intranet. You can locate files
by keywords. Consider including this page in any site you create with the Web Publishing
Wizard. Consult your administrator to get a copy, or learn about the location of
this page on your intranet.
<HR>
</BLOCKQUOTE>
<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
<DL>
<DD><B>1.</B> Choose <U>F</U>ile, Save As HTML with a datasheet, <I>form</I>, or
<I>report</I> open; click the I Want to Use a Web Publication Profile check box;
and select that publication if you have already created a Web page or set of pages
in the format you want using the wizard (if you don't have any Web pages already
created, this option will be grayed out). Choose <U>N</U>ext. <BR>
<BR>
<B>2.</B> Click either Select or Select <U>A</U>ll in the check box to select the
<I>table</I>(s), <I>query</I>(s), form(s), and report(s) you want to publish. Choose
<U>N</U>ext. <BR>
<BR>
<B>3.</B> Select the HTML template document you want to use, then choose <U>N</U>ext.
You can select the type of document you want to create: <U>S</U>tatic HTML, <U>D</U>ynamic
HTX/IDC, or Dy_namic ASP. <B><BR>
<BR>
4.</B> On the next one or two screens (depending on your choice in Step 3), enter
the location of the folder (and server if prompted) that you want to save your files
to. <BR>
<BR>
<B>5.</B> Click the <U>Y</U>es, I Want to Create a Home Page check box if you want
that feature; name that page (Default is the default); then choose <U>N</U>ext. <B><BR>
<BR>
6.</B> On the final page of the wizard, select the <U>Y</U>es, I Want to Save the
Answers to the Wizard check box if you want to create a Web publication profile;
enter the name in <U>P</U>rofile Name; then choose <U>F</U>inish.
</DL>
<P>Access creates the pages you specified from each <I>object</I>. It also creates,
if specified, the publication profile.
</TD>
</TR>
<TR>
<TD WIDTH="80"></TD>
<TD WIDTH="520">
<P ALIGN="CENTER"><A HREF="index.htm"><IMG
SRC="../buttonart/btoc.gif" WIDTH="41" HEIGHT="41" ALIGN="BOTTOM" ALT="TOC" BORDER="0"
NAME="toc8"></A><A HREF="ch06.htm"><IMG
SRC="../buttonart/bback.gif" WIDTH="41" HEIGHT="41" ALIGN="BOTTOM" ALT="BACK" BORDER="0"
NAME="toc6"></A><A HREF="ch08.htm"><IMG
SRC="../buttonart/bforward.gif" WIDTH="41" HEIGHT="41" ALIGN="BOTTOM" ALT="FORWARD"
BORDER="0" NAME="toc7"></A><A HREF="index.htm"><IMG
SRC="../buttonart/bhome.gif" WIDTH="41" HEIGHT="41" ALIGN="BOTTOM" ALT="HOME" BORDER="0"
NAME="toc5"></A><BR>
<BR>
<IMG SRC="../buttonart/corp.gif" WIDTH="284" HEIGHT="45" ALIGN="BOTTOM" BORDER="0"></P>
<P><BR>
<FONT COLOR="#000000">©</FONT><A HREF="copy.htm"><FONT COLOR="#000000">Copyright</FONT></A><FONT
COLOR="#000000">, Macmillan Computer Publishing. All rights reserved.</FONT>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -